我的查询以错误“ora-00933 sql命令未正确结束”结束“查询:第一个我的错误在哪里?我应该用trunc和date吗?我尝试将联接运算符放在()中
8fq7wneg1#
密码没问题。示例表:
SQL> create table documentdata as select 1 bigtriggerid from dual; Table created. SQL> create table ipl_bigtrigger as select 1 triggerid, 'T' processed, date '2022-02-25' processdatetime from dual; Table created. SQL> create table documentinfo as select 1 bigtriggerid, 1 status from dual; Table created.
您的查询,as is:
SQL> CREATE TABLE tmp_cleaner 2 AS 3 (SELECT dd.bigtriggerid 4 FROM documentdata dd 5 INNER JOIN ipl_bigtrigger bt ON dd.bigtriggerid = bt.triggerid 6 INNER JOIN documentinfo di ON dd.bigtriggerid = di.bigtriggerid 7 WHERE bt.processed = 'T' 8 AND di.status IN (1, 2) 9 AND bt.processdatetime <= ADD_MONTHS (SYSDATE, -3)); Table created. SQL> select * from tmp_cleaner; BIGTRIGGERID ------------ 1 SQL>
你能提供一些背景吗?你在哪里运行了那段代码?delete也没有什么问题(除了在子查询中使用了一个新表;这不应该是您刚刚创建的tmp_cleaner吗?):
delete
tmp_cleaner
SQL> Delete FROM documentdata 2 where exists (select bigtriggerid 3 from tmp_cleaner -- tmp_loeschbigtrigger 4 where bigtriggerid = documentdata.bigtriggerid); 1 row deleted. SQL>
1条答案
按热度按时间8fq7wneg1#
密码没问题。
示例表:
您的查询,as is:
你能提供一些背景吗?你在哪里运行了那段代码?
delete
也没有什么问题(除了在子查询中使用了一个新表;这不应该是您刚刚创建的tmp_cleaner
吗?):