在执行上述SQL之后,将显示0 Record Merged。 想知道为什么记录未插入表中吗?
表中没有bic = 'WLDSGB40XXX'
的记录:
merge INTO BANK_DATA D
USING (SELECT *
FROM BANK_DATA
WHERE bic = 'WLDSGB40XXX') s
ON (D.bic = s.bic)
WHEN matched THEN
UPDATE SET D.name = 'LONDON',
D.bank_name = ' SERVICES LIMITED',
D.address = 'ONE OLIVERS YARD',
D.city = 'LONDON',
D.country = 'GB'
WHERE (d.bic = 'WLDSGB40XXX' )
WHEN NOT MATCHED THEN
INSERT (d.ID, d.TYPE, d.NAME, d.bank_name, d.address, d.city, d.country, d.bic)
VALUES ((SELECT MAX(to_number(id)) + 1 FROM BANK_DATA),
'01',
'LONDON',
'LIMITED',
'ONE YARD',
'1',
'1',
'GB40XXX'
);