SQL 查询 "00904. 00000 - "%s: 无效标识符"
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29546620/
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
SQL Queries "00904. 00000 - "%s: invalid identifier"
提问by Jonathan Steward
Hi I have the following code
嗨,我有以下代码
SELECT entertainer_id,
entertainer_groupname
FROM casestudy_entertainer
INNER JOIN casestudy_availability ON
casestudy_entertainer.entertainer_id
= CASESTUDY_AVAILABILITY.AVAILABILITY_ENTERTAINERID
INNER JOIN casestudy_calendardates ON
CASESTUDY_AVAILABILITY.AVAILIBILITY_CALENDARDATEID
= casestudy_calendardates.calendar_Id
WHERE entertainer_type = '&Entertainer_TYPE'
AND casestudy_calendardates.calendar_date = '&Event_date'
And I don't seem to be able to figure out what its not liking when I run this. It gives me the following error
当我运行它时,我似乎无法弄清楚它不喜欢什么。它给了我以下错误
ORA-00904: "CASESTUDY_AVAILIBILITY"."AVAILIBILITY_CALENDARDATEID": invalid identifier 00904. 00000 - "%s: invalid identifier" *Cause:
*Action: Error at Line: 7 Column: 4
ORA-00904: "CASESTUDY_AVAILIBILITY"."AVAILIBILITY_CALENDARDATEID": 无效标识符 00904. 00000 - "%s: invalid identifier" *Cause:
*Action: Error at Line: 7 Column: 4
I do have all the tables in place with all the correct rows. The only thing is I have no data as of yet, Could this possibly be the issue?
我确实将所有表格都放在了正确的位置上。唯一的问题是我还没有数据,这可能是问题吗?
回答by potashin
You should try the lower case for the table/column identifiers(like in from
/inner join
clauses):
您应该尝试使用小写的表/列标识符(如from
/inner join
子句中):
SELECT entertainer_id,
entertainer_groupname
FROM casestudy_entertainer
INNER JOIN casestudy_availability ON casestudy_entertainer.entertainer_id = casestudy_availability.availability_entertainerid
INNER JOIN casestudy_calendardates ON casestudy_availability.availibility_calendardateid = casestudy_calendardates.calendar_id
WHERE entertainer_type = '&Entertainer_TYPE'
AND casestudy_calendardates.calendar_date = '&Event_date'
回答by Prajwal Rai
You have same tablenames in your tables while left joining.
离开加入时,您的表中有相同的表名。
Change tablename of one , it will work.
将 tablename 更改为 one ,它将起作用。
回答by Gangnus
What is interesting, Oracle gives that message not only if the name of the column is bad, but also if the name of the table/alias is bad - not defined alias, twice defined (as mentioned @PrajwalRai), error in the table name.
有趣的是,Oracle 不仅会在列名错误的情况下发出该消息,而且还会在表/别名的名称错误时发出该消息 - 未定义别名,两次定义(如@PrajwalRai 所述),表名错误.
回答by evamarie42
no data is not the issue, you won't simply get a null result. ORA-00904 indicates, that you used a column that does not exist or does not comply to the Oracle specification.
没有数据不是问题,您不会简单地得到空结果。ORA-00904 表示您使用了不存在或不符合 Oracle 规范的列。
Please check for correct naming. You might be better of with shorter names or at least table aliasses to get to code more readable.
请检查正确的命名。您可能最好使用较短的名称或至少表别名以使代码更具可读性。
Without knowing your table structure I cannot tell you where the error is. do a describe table_name;
在不知道您的表结构的情况下,我无法告诉您错误在哪里。做一个describe table_name;
It would also help to have the oracle version number SELECT * FROM V$VERSION
or SELECT version FROM V$INSTANCE
and your client software you are using
拥有 oracle 版本号SELECT * FROM V$VERSION
或SELECT version FROM V$INSTANCE
您正在使用的客户端软件 也会有所帮助
回答by PriyaDev
This Error is caused by a special character in one of the columns of the database table. DBA will be able to help you.
此错误是由数据库表的列之一中的特殊字符引起的。DBA 将能够帮助您。