|
-
Hi.
It's pretty simple when you know know what it is.
You cannot put a column that is in the ON clause into the UPDATE statement. This means that this will fail:
merge into tab1 t1
using (select * from tab1) t2
on (t1.id = t2.id)
when matched then
update set t1.id = t2.id, -- Dodgy line
t1.description = t2.description
when not matched then
insert (id, description)
values (t2.id, t2.description);
but this will work:
merge into tab1 t1
using (select * from tab1) t2
on (t1.id = t2.id)
when matched then
update set t1.description = t2.description
when not matched then
insert (id, description)
values (t2.id, t2.description);
The impact of this is that there are some situations where you just can't use a merge. Namely when you need to update a column that you are using to identify the record in the ON clause.
Cheers
Tim...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|