oracle多表关联删除的两种方法

时间:2023-03-08 23:42:12
oracle多表关联删除的两种方法

oracle多表关联删除的两种方法

第一种使用exists方法

delete
from tableA
where exits
(
select 1
from tableB
Where tableA.id = tableB.id
)

第二种使用匿名表方式进行删除

delete
from
(
select 1
from tableA,TableB
where tableA.id = tableB.id
)

这种方法只适合两个表都有主键或外键的时候,若是关联一个管道函数就无法删除成功,会提示错误