declare
Input_ID varchar2(5):='12345';
value1 varchar2(10):='ABCDEFGHIJ';
begin
Merge into Target
using (select ID from TableAAA where ID = Input_ID ) Source
on (Target.ID= Source.ID)
when matched then
update set col1 = value1
when not matched insert (col1) values (value1);
end;
The above merge statement, checks if ID in target, matches with ID from source and inserts if match not found in Target. I want to insert a record in target, if the ID found in Source, but not in Target.
And I don't want to insert anything in Target, if match not found from Source. How can I achieve it.
Thanks for the suggestions in advance.