ORA-00904: string: invalid identifier
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: column ambiguously defined
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: missing expression
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: table or view does not exist
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.