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!

update w/self referencing select?

dkolearyNov 10 2009 — edited Nov 10 2009
Hey;

This doesn't seem like it should be too difficult; however, I can't seem to wrap my head around it.

I have a table w/following structure:

city
state
region

Due to the way the table is getting populated, some of the regions are null. Such that:

madison
wisconsin
Midwest

and

milwaukee
wisconsin
<null>

I would like to periodically update the region column with relevent information.

I'm pretty sure I need a look up table and have already generated one:

create table as
(select unique state region
from regions where region is not null);

but, I can't quite seem to grasp the sql to update the regions table from the lookup. Probably my procedural programming mindset getting in the way again.

Can someone provide the needed clue?

Thanks.

Doug O'Leary
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 8 2009
Added on Nov 10 2009
6 comments
812 views