Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Can MERGE replace UPDATE/INSERT duo on a single table?
The problem is that the
select * from employee where user_id = 'john123'
returns no rows.
If it helps this works, if user_id is a unique key
merge into employee s
using
(
select user_id from (
select user_id from employee where user_id = 'john123' union all select NULL user_id from dual
update set s.pay=50000
when not matched then
insert (s.user_id, s.pay, s.service_name, s.authorized_for) values ('john123', 50000, 'foo', 'ALL') Received on Wed Apr 07 2004 - 09:54:35 CDT