SQL错误:ORA-00936:缺少表达式 [英] SQL Error: ORA-00936: missing expression
问题描述
运行此查询后,我正确获得结果:
SELECT REGEXP_REPLACE(REGEXP_SUBSTR(TBLUSERACTIVITIES.ACTION,'Event [0-9] +'),'事件')作为EventId1,REGEXP_REPLACE(REGEXP_SUBSTR(TBLUSERACTIVITIES.ACTION,'事件[0-9] +',1,2,'i'),'事件')作为EAIEMP.TBLUSERACTIVITIES TBLUSERACTIVITIES的事件Id2
Out Put:
EventID1 | EventID2
123 | 235
但是在运行此查询时我收到的错误是:
After running this query I am getting Result properly:
SELECT REGEXP_REPLACE(REGEXP_SUBSTR(TBLUSERACTIVITIES.ACTION, 'Event [0-9]+'),'Event ') as EventId1, REGEXP_REPLACE(REGEXP_SUBSTR(TBLUSERACTIVITIES.ACTION, 'Event [0-9]+',1,2,'i'),'Event ') as EventId2 FROM EAITEMP.TBLUSERACTIVITIES TBLUSERACTIVITIES
Out Put :
EventID1 | EventID2
123 | 235
But While running this query i am getting error as :
Error report:
SQL Error: ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action:
插入EAITEMP.TBLUSERACTIVITIES(EventID1,EventID2)值(SELECT REGEXP_REPLACE(REGEXP_SUBSTR(TBLUSERACTIVITIES.ACTION,'Event [0-9] +'),'Event')as EventId1,REGEXP_REPLACE(REGEXP_SUBSTR(TBLUSERACTIVITIES.ACTION,'Event [0-9] +',1,2,'i'),'Event')作为EventId2来自EAITEMP.TBLUSERACTIVITIES TBLUSERACTIVITIES);
先谢谢
insert into EAITEMP.TBLUSERACTIVITIES(EventID1, EventID2) values(SELECT REGEXP_REPLACE(REGEXP_SUBSTR(TBLUSERACTIVITIES.ACTION, 'Event [0-9]+'),'Event ') as EventId1, REGEXP_REPLACE(REGEXP_SUBSTR(TBLUSERACTIVITIES.ACTION, 'Event [0-9]+',1,2,'i'),'Event ') as EventId2 FROM EAITEMP.TBLUSERACTIVITIES TBLUSERACTIVITIES);
Thanks in Advance
推荐答案
你不应该在INSERT INTO中使用VALUES子句.... SELECT
试试这个语法:
You should not use the VALUES clause with INSERT INTO .... SELECT
Try this syntax:
INSERT INTO Table1 (Col1, Col2)
SELECT Col1, Col2 FROM Table2
这篇关于SQL错误:ORA-00936:缺少表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!