本文介绍了带有JOIN的Oracle DELETE sql不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的delete语句在Oracle中返回933错误,我不确定是什么错误-
My delete statement returns a 933 error in Oracle, I'm not sure what is wrong-
DELETE b
from temp a
JOIN
fact_tab b
on a.col1 = b.col1
and a.col2 = b.col2
and a.col3 = b.col3;
两个表都没有主键.选择语句在同一件事上起作用-
Both tables dont have a primary key. select statement on the same thing works-
select *
from temp a
JOIN
fact_tab b
on a.col1 = b.col1
and a.col2 = b.col2
and a.col3 = b.col3;
推荐答案
Oracle不允许直接在DELETE语句中加入JOIN.
Oracle doesn't allow JOIN in a DELETE statement directly like that.
您可以通过以下方式进行删除:
You could do the delete in the following way:
DELETE
FROM fact_tab
WHERE ROWID IN
(SELECT b.rowid
FROM temp a
JOIN fact_tab b
ON a.col1 = b.col1
AND A.col2 = b.col2
AND A.col3 = b.col3
);
您还可以使用WHERE EXISTS
子句.
这篇关于带有JOIN的Oracle DELETE sql不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!