ORA-00900 to ORA-01499
ORA-00904: "【列名】": 标识符无效
ORA-00904: string: invalid identifier
原因1: 输入的列名称缺失或无效。
The column name entered is either missing or invalid.
- 状态: 已验证。
措施: 输入有效的列名称。有效的列名称必须以字母开头,小于或等于30个字符,并且只包含字母数字字符和特殊字符$,_和#。如果包含其他字符,则必须用双引号括起来。它也不能为保留字(否则也得用双引号括起来)。
Enter a valid column name. A valid column name must begin with a letter, be less than or equal to 30 characters, and consist of only alphanumeric characters and the special characters $, _, and #. If it contains other characters, then it must be enclosed in double quotation marks. It may not be a reserved word.
ORA-00918: 未明确定义列
ORA-00918: column ambiguously defined
原因1: 多表连接中的列在一个以上的表中存在同名列,导致引用不明。连接中使用的列名称存在于多个表中,因此引用不明。在连接中,任何存在于多表中的列名称在引用时必须以其表名作为前缀。该列应该通过TABLE.COLUMN或TABLE_ALIAS.COLUMN来引用。例如,如果表EMP和DEPT正被连接,且都包含列DEPTNO,则所有对DEPTNO的引用应以表名作为前缀,如EMP.DEPTNO或E.DEPTNO。
A column name used in a join exists in more than one table and is thus referenced ambiguously. In a join, any column name that occurs in more than one of the tables must be prefixed by its table name when referenced. The column should be referenced as TABLE.COLUMN or TABLE_ALIAS.COLUMN. For example, if tables EMP and DEPT are being joined and both contain the column DEPTNO, then all references to DEPTNO should be prefixed with the table name, as in EMP.DEPTNO or E.DEPTNO
- 状态: 已验证。
分析: 由于在sql语句涉及的多个表或视图中存在和要使用的列相同名称的列,Oracle不知道你到底要用哪个表或视图的该名称的列。
-- 建两个表及一个视图 create table ora_00918_1(a varchar2(30), b varchar2(30)); create table ora_00918_2(a varchar2(30), b varchar2(30)); create view ora_00918_3 as select * from ora_00918_2; -- 下面查询都报错 select * from ora_00918_1,ora_00918_2 where a = 1; select b from ora_00918_1,ora_00918_2; select a from ora_00918_1,ora_00918_3; -- 不用以为加了(表名.)或(表别名.)取字段就万无一失了~当关联了一大堆的表后细心才是王道 select t.a from ora_00918_1 t,ora_00918_1 t;
措施: 使用表名或表别名和句号(.)在多个表中存在的列名进行前缀引用,如上例所示。(细心排查,加上表名或表别名的前缀,注意表别名别重复)
Prefix references to column names that exist in multiple tables with either the table name or a table alias and a period (.), as in the examples above.
ORA-00936: 缺失表达式
ORA-00936: missing expression
原因1: 遗漏了子句或表达式的必需部分。例如,SELECT语句可能没有列或表达式,或表达式不完整。误用保留关键字也会导致此异常,例如在SELECT TABLE中使用保留关键字。
A required part of a clause or expression has been omitted. For example, a SELECT statement may have been entered without a list of columns or expressions or with an incomplete expression. This message is also issued in cases where a reserved word is misused, as in SELECT TABLE.
- 状态: 待完善。
措施: 检查语句语法并指定缺少的组件。
Check the statement syntax and specify the missing component
ORA-00942: 表或视图不存在
ORA-00942: table or view does not exist
原因1: 输入的表或视图不存在,可能使用了不允许的同义词,或者在需要表的情况下引用了视图。可以通过查询数据字典来列出现有的用户表和视图。访问表可能需要某些特定的权限。如果应用程序返回此消息,则应用程序尝试访问的表不存在于数据库中,或应用程序无权限获取它的数据。
The table or view entered does not exist, a synonym that is not allowed here was used, or a view was referenced where a table is required. Existing user tables and views can be listed by querying the data dictionary. Certain privileges may be required to access the table. If an application returned this message, the table the application tried to access does not exist in the database, or the application does not have access to it.
- 状态: 已验证。
措施: 核查下列项:
- 表或视图名的拼写。
- 在要求表的地方未使用视图。
- 现有的表或视图名称存在。 如果需要创建表或者用户或应用程序需要权限才能访问该表,请与数据库管理员联系。 此外,如果尝试访问另一个模式中的表或视图,请确保引用正确的模式,并授予了对对象的访问权限。
Check each of the following:
- the spelling of the table or view name.
- that a view is not specified where a table is required.
- that an existing table or view name exists. Contact the database administrator if the table needs to be created or if user or application privileges are required to access the table. Also, if attempting to access a table or view in another schema, make certain the correct schema is referenced and that access to the object is granted.