您的位置:首页 > 数据库 > Oracle

oracle多表关联删除数据表记录方法

2013-06-28 16:31 211 查看
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
)


这种方法只适合两个表都有主键或外键的时候,若是关联一个管道函数就无法删除成功,会提示错误
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: