oracle insert update 一个语句搞定

  不多说了,看代码(注意条件)

View Code
 1 merge into regularreport using 
 2 (
 3     select count(guid) count from regularreport where 
 4     project='ae1a0218-98ea-4ec7-b5f3-a559b8ee60f6'
 5     and regulardate = '2012-10-29~2012-11-04/第45周'
 6 )  
 7 regularreportcount   on (regularreportcount.count<>0)
 8 when matched then 
 9     update set requiredtime =
10     to_date('111111111111' ', 'YYYY-            MM-DD hh24:mi:ss')
11      where project='ae1a0218-98ea-4ec7-b5f3-a559b8ee60f6'  
12      and regulardate = '2012-10-29~2012-11-04/第45周'
13 when not matched then
14      insert (guid,remark) 
15     values (sys_guid(),'this is insert')

因为 update 有where 适用于oracle 9+

转载于:https://www.cnblogs.com/chuanzhifeng/archive/2012/11/21/2781113.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值