1. 程式人生 > >oracle多表關聯刪除的兩種方法

oracle多表關聯刪除的兩種方法

多表關聯 sele ble 成功 exit sts rac style 方法

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
)


這種方法只適合兩個表都有主鍵或外鍵的時候,若是關聯一個管道函數就無法刪除成功,會提示錯誤

oracle多表關聯刪除的兩種方法