Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Join on vs intersect, for update query with Multiple tables??

Re: Join on vs intersect, for update query with Multiple tables??

From: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 29 Jan 2007 11:19:15 -0800
Message-ID: <1170098351.88372@bubbleator.drizzle.com>


qazmlp1209_at_rediffmail.com wrote:
> For the given problem, we have arrived at 2 solutions:
>
> Solution-1:

>>> update tab2 t2_alias
>>> set col_c_2 = null
>>> where exists
>>>   (select col_a_1
>>>   from
>>>     (select col_a_1, col_b_2, col_C_2, count(col_a_1) over (partition by
>>> col_a_1
>>>     order by col_a_1) as data_count
>>>     from tab1
>>>     join tab2 on (col_a_1 = col_a_2)
>>>     where col_b_1 = 'true'
>>>     )
>>>   where data_count = 1
>>>   and col_a_1 = t2_alias.col_a_2)

>
> Solution-2:
>> UPDATE tab2
>> SET col_c_2 = null
>> WHERE col_a_1 IN
>>  ( SELECT col_a_1 FROM tab1 WHERE col_b_1 = 'true'
>>          INTERSECT
>>          SELECT col_a_2 FROM tab2 GROUP BY col_a_1 HAVING count(1) = 1
>>  );

>
> Can anybody comment on which one is more performant ...

No. Is there something preventing you from running them?

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Mon Jan 29 2007 - 13:19:15 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US