Hi I'm trying to use the merge command but have encountered a problem which does not seem to make sense. I am running the following code:
merge into dest
using src
on (dest.client_number = src.nclient)
when matched then
update set
dest.client_number = src.nclient
when not matched then
insert (dest.client_number)
values
(src.nclient)
The cause is that you cannot update a column that has been referenced in the ON condition clause.
Restrictions on the update clause:
- You cannot specify DEFAULT when updating a view.
- You cannot update a column that has been referenced in the ON condition clause.
- You cannot update the same row of the target table multiple times in the same MERGE statement.
Prerequisites:
- You must have INSERT and UPDATE object privileges on the target table
and SELECT privilege on the source table.
Restrictions on the update clause:
- You cannot specify DEFAULT when updating a view.
- You cannot update a column that has been referenced in the ON condition clause.
- You cannot update the same row of the target table multiple times in the same MERGE statement.
Prerequisites:
- You must have INSERT and UPDATE object privileges on the target table
and SELECT privilege on the source table.