首页 > 数据库技术 > 详细

Oracle merge into 使用记录

时间:2015-05-26 09:03:58      阅读:205      评论:0      收藏:0      [点我收藏+]

符合条件进行更新操作,不符合则进行插入操作.

merge into myd_nsrdt n
using (select 9as mydtmid,1as tmtype,370200123456788as nsrsbh,‘‘ as nsrmc,
  sn as region,4 as pf,‘‘as yj,18888888888 as phone,18888888888 as nowphone,sysdate as addtime from dual) m
on(n.mydtmid=m.mydtmid and n.nsrsbh=m.nsrsbh)
when matched then
  update set n.pf=m.pf,n.yj=m.yj
    where n.mydtmid=m.mydtmid and n.nsrsbh=m.nsrsbh
when not matched then
  insert values(seq_myd.nextval,m.mydtmid,m.tmtype,m.nsrsbh,m.nsrmc,m.region,m.pf,m.yj,m.phone,m.nowphone,m.addtime)

 

Oracle merge into 使用记录

原文:http://www.cnblogs.com/yshyee/p/4529619.html

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