MERGE INTO with a hint [message #162346] |
Thu, 09 March 2006 17:49 |
a_developer
Messages: 194 Registered: January 2006
|
Senior Member |
|
|
I saw this SQL below in one of the topics posted. I just added a parallel hint:
merge /*+ parallel (emp,6) */
into tabA a
using ( SELECT c.prod_id,
c.as1,
c.val_amount
from tabB b,
tabC c
where (b.date < sysdate
and b.b_no = c.c_no
and b.dimd = c.dimd
) YY
on (a.prod_id = YY.prod_id )
when matched then
UPDATE set a.asl = YY.as1
a.aq1 = a.del * YY.val_amount;
I have a similar case, and just wondering if the hint applies to the SELECT or the UPDATE???
[Updated on: Thu, 09 March 2006 17:50] Report message to a moderator
|
|
|
|
|
Re: MERGE INTO with a hint [message #162362 is a reply to message #162361] |
Thu, 09 March 2006 20:29 |
rranjan1
Messages: 3 Registered: March 2006 Location: Singapore
|
Junior Member |
|
|
Just INsert & Update do not require MERGE statement use.
ex: INSERT into table_name values (A,B,C)
select A,B,C from <condition>
-- Update based on condition. The condition should pass WHERE clause and then accordingly SET colm values. Here WHERE condition and select condition are same.
UPDATE table_name
set col_name = < select col_name from tablename where <condition>
where exists ( select col_name from tablename where <condition> )
|
|
|
Re: MERGE INTO with a hint [message #162383 is a reply to message #162362] |
Fri, 10 March 2006 00:19 |
a_developer
Messages: 194 Registered: January 2006
|
Senior Member |
|
|
I think the purpose of merge is to simply the combination of select and update at the same time. Can you please translate the MERGE statement above to a simple UPDATE statement whose cost will be less than when using MERGE??
|
|
|