oracle merge into 的用法

Merge into YX_KSSSXXB t
using (select count(ksh) count from YX_KSSSXXB where ksh = '555555') num2
on (num2.count <> 0)
when matched then
  update
     set t.ldm = '2', t.fhid = '2', t.cph = '1003', t.sfsz = '0'
   where ksh = '666666'
when not matched then
  insert
    (ksh, ldm, fhid, cph, sfsz)
  values
    ('555555', '2', '2', '2001', '1')

你可能感兴趣的:(oracle merge into 的用法)