Hi gayathri,
'on' keyword is just for joining the merge to table and 'using'  query.
it is generally  keycolumn=keycolumn

if you want additional conditions you may give it with update.

when matched then
  update x=10 where yourcondition1
   update  y=12 where  yourcondition2

i am not sure whether two updates will work.
if it does'nt you may try giving when matched a second time and then giving
the second update.

in sqlserver we can give  and condition with when matched

when mathed and x=y  then

but that is not possible in oracle.

update and delete works together but two updates? I have never tried.

please share with us the results of these experiments.

regards
Gopa

On Jan 21, 2011 11:24 AM, "gayathri Dev" <gd0...@gmail.com> wrote:

Hi All,

I want to have multiple ON condition and corresponding Update statements in
Merge command. Is it possible?

Eg:
Merge into cust C
using (select o1, o2, o3 from Order ) O
on (
      (C.c1 = O.o1 and C.c2 = O.o2) --- condition 1
      OR
      (C.c1 = O.o1 and C.c2 = O.o2) --- condition 2
)
when matched then
 Update c1, c2  -- for condition1 match
 Update c3, c4  -- for condition2 match
when not matched then
 Insert
;


Or is there any other better way to do this?

Appreciate if I can get a solution at the earliest.

Thanks
G

 --
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to