Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: QUERY
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 )
and b.trail_code = a.trail_code
It returns 2599 rows.
Wondering what is wrong?
thx
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlput 'unsubscribe' in the subject line.
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org
![]() |
![]() |