Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Question: Where Clause In Update Statement - Updating all the rows

2776946May 20 2015 — edited May 22 2015

so my question is from this link, a fairly short and easy read. Or you can read what I post below.

4 ways to do multiple table update in Oracle (what works and what not)

here is what my question is based off of:

The query below does NOT work for this conditional update. It always updates all rows in PICTURE column in table Categories_Test.

update Categories_Test a set a.Picture =

(select b.Picture from Categories b

where b.Category_ID = a.Category_ID and b.Category_Name = 'Seafood');

Question: for all the rows updated in categories test that don't match the WHERE condition of a matching ID value restricted to 'Seafood'..

(1)Will the update on those rows for the given column be null, (2)or will all the rows in the Picture column be updated to the value found in the seafood column..

The first seems correct, and the second one doesn't make any sense. I just want some others' insight.

Thanks much.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 18 2015
Added on May 20 2015
13 comments
998 views