DELETE mp.*, rp.*, per.*, pv.*
FROM my_privilege mp
LEFT JOIN ro_priv rp ON rp.privilege_id IN (privilege_id_rep)
LEFT JOIN person_priv per ON per.person_priv_id IN (privilege_id_rep)
LEFT JOIN privilege pv ON pv.privilege_id IN (privilege_id_rep)
WHERE (logino_id = p_int_logino_id);
上面的代码是在mysql中的删除操作,我需要将其转换为oracle 12c数据库。 你能帮我吗
由于Oracle在单个查询中将不支持多个删除。
我需要一种有空时如何执行删除操作的方法
delete from table
left join table1
left join table2
left join table3
left join table4
where condition
操作
答案 0 :(得分:1)
据我所知,在Oracle中,您应该删除逐个表,即,您不能在单个DELETE
语句中影响多个表。因此,应该是
delete from my_privilege mp
where mp.some_id in (select x.some_id from some_other_table x ...);
delete from person_priv per
where per.some_id in (select x.some_id from some_other_table x ...);
etc.
如果存在外键约束,请查看是否使用ON DELETE CASCADE
,以便删除主行会删除所有详细信息(在单个语句中)。