oracle ORA 00904 错误:无效标识符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11277135/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ORA 00904 Error:Invalid Identifier
提问by Mistu4u
I have installed Oracle 10g in my virtual XP and created a table using
我已经在我的虚拟 XP 中安装了 Oracle 10g 并使用创建了一个表
create table reg1 (
fname varchar2(30),
lname varchar2(30),
addr varchar2(30),
mail varchar2(30),
occu varchar2(30),
uname varchar2(30),
passwd varchar2(30)
);
and the table created successfully.But when I am trying to fetch the values by simple query like
并且表创建成功。但是当我尝试通过简单的查询获取值时
select fname, lname
from reg1
where uname="bbb";
I am getting error like
我收到类似的错误
ORA-00904: "bbb": invalid identifier
ORA-00904: "bbb": 无效标识符
I cannot understand what I have done wrong here.
我无法理解我在这里做错了什么。
回答by Andrew Leach
Use single quotes.
使用单引号。
select fname,lname from reg1 where uname='bbb';
回答by Ben
Oracle uses double quotes "in order to identify cased object names. For instance the table "test"is not the same as the table test.
Oracle 使用双引号"来标识大小写的对象名称。例如 table"test"与 table 不同test。
Strings should be enclosed by single quotes, '.
字符串应该用单引号括起来,'.
Making your query:
进行查询:
select fname, lname from reg1 where uname = 'bbb';
What's actually happening in your query is Oracle is trying to find the column "bbb"in the table reg1, as this column doesn't exist you get the error thrown.
在您的查询中实际发生的是 Oracle 试图"bbb"在表中查找该列reg1,因为该列不存在您会抛出错误。

