Merge into Temp1 a
using (select ID
From (Select ID
From Temp1
where ID = ' SYSTEM00000100000010846 '
UNION ALL
Select null ID from dual)
where rownum = 1) b
On (b.id = a.id)
When matched then
Update
Set report_date = To_date (' 2014/5/22-0:00:00 ',
' Yyyy-mm-dd hh24:mi:ss '),
report_sup_id = ' gy20t0000201000015754595 ',
report_sup_name = ' Beijing Military District Taiyuan Medicinal material Supply Station 2 ',
VOUCHER = ' ',
DIGEST = ' Today 10846 ',
Borrow_value = 1000,
Loan_value =-1,
DIRECTION = ' borrowed ',
BALANCE = 2990
When isn't matched then
Insert
(ID,
Report_date,
REPORT_SUP_ID,
Report_sup_name,
VOUCHER,
DIGEST,
Borrow_value,
Loan_value,
DIRECTION,
BALANCE)
Values
(' SYSTEM00000100000010846 ',
To_date (' 2014/5/22 0:00:00 ', ' yyyy-mm-dd hh24:mi:ss '),
' gy20t0000201000015754595 ',
' Beijing Military Region Taiyuan Medicinal supplies Station 2 ',
‘‘,
' Today 10846 ',
1000,
-1,
' Borrow ',
2990)