首页 > 数据库技术 > 详细

Oracle Delete inner的方式,级联删除子表的数据方式。

时间:2016-12-20 00:43:42      阅读:288      评论:0      收藏:0      [点我收藏+]

例子1:

delete from table1 a where exists (select 1 from table2 b where a.id=b.id)

例子2:

rebatepolicy表是主表,rebatepolicyitems是从表,从表有主表的主键,现在对于主表一些条件的数据的对应子表要求删除。

如下方式:

delete from rebatepolicyitems rs where exists
(
      select 1
      from rebatepolicy r  where rs.rebateguid=r.rebateguid
      and to_char(r.createdate,yyyyMMdd)=20161219 and r.creator=名字 
)

 

delete from table1 a where exists (select 1 from table2 b where a.id=b.id)

Oracle Delete inner的方式,级联删除子表的数据方式。

原文:http://www.cnblogs.com/alsf/p/6200924.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!