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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: QUERY

RE: QUERY

From: Powell, Mark D <mark.powell_at_eds.com>
Date: Wed, 28 Apr 2004 08:51:04 -0400
Message-ID: <564DE4477544D411AD2C00508BDF0B6A1CE0AAEA@usahm018.exmi01.exch.eds.com>


Both you queries are returning exactly what you asked. In the first case you update every row in main_test to the value returned by the subquery including null when no match exists because you did not place a where clause restriction on the main_test update. Your second form of the query restricts the update to those rows that meet the subquery conditions.

HTH -- Mark D Powell --

-----Original Message-----

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Seema Singh Sent: Tuesday, April 27, 2004 9:45 PM
To: oracle-l_at_freelists.org
Subject: QUERY

Hi

Any advice are welcome.
update main_test a
set a.directions =(select b.access1 from trail_main b where b.trail_name = a.trail_name

     and b.trail_code = a.trail_code)
This is updating 6595 rows.

update main_test a
set a.directions = (select access1 from trail_main b

                     where a.trail_name = b.trail_name
                       and a.trail_code = b.trail_code )
where a.trail_id = ANY (select a.trail_id from
                                vw_trail_main_test a, trail_main b
                         where a.trail_name = b.trail_name and a.trail_code 
= b.trail_code )
This is updating 2599 rows updated.
When I select
select b.access1 from trail_main b
where b.trail_name = a.trail_name

     and b.trail_code = a.trail_code
It returns 2599 rows.

Wondering what is wrong?
thx



FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.com/go/onm00200415ave/direct/01/

Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--

Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html

-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.
--

Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
Received on Wed Apr 28 2004 - 07:49:09 CDT

Original text of this message

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