分类: Oracle
ORA-00936:missing expression
Cause: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.
Action:Check the statement Syntax and specify the missing component.
我遇到的2种 ORA-00936: missing expression 报错情况
1、插入表数据 insert into t1 values select 1 from dual;
2、用pl/sql developer 工具比较时报错 原因:表字段是oracle关键字----也就是在查询这个带有关键字列的时候
测试1:
sql> create table t1 ("desc" varchar2(10));
表已创建。
sql> desc t1;
名称 是否为空? 类型
----------------------------------------- -------- ----------------------------
desc VARCHAR2(10)
sql> insert into t1 values select 1 from dual;
insert into t1 values select 1 from dual
*
第 1 行出现错误:
ORA-00936: 缺失表达式
sql>解决就是把values去掉就可以了
测试2:
sql> select desc from t1;
select desc from t1
*
第 1 行出现错误:
ORA-00936: 缺失表达式
sql>
测试2(2):用pl/sql developer 工具比较时的报错
解决方法:
ALTER TABLE T1 RENAME COLUMN "desc" TO desc_;(比较的话目标和源库都要相同)
再比较或者查询就没有问题了
祝好~