不多说了,看代码(注意条件)
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
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+