We help IT Professionals succeed at work.
Get Started

Oracle Script to Update One Table's Field Based on Another Table

cbridgman
cbridgman asked
on
114 Views
Last Modified: 2016-03-04
I'm sure this is a simple query but here goes ... I have two related tables A and B. One record in table A might have many related records in table B. If it does, I want to update one column in all of table B's related records with a specific value based on a value in Table A.

So, for example, if TABLEA.COLUMN3 = 123 then I want to update TABLEB.COLUMN5 values to 'ABC' in all related TABLEB records. Another example  --> if TABLEA.COLUMN1 = 456, then I want to update TABLEB.COLUMN5 values to 'DEF' in all related TABLEB records.

Something like (I know this isn't right):

update TABLEB
from TABLEA
set TABLEB.COLUMN5 = 'ABC'
where TABLEA.COLUMN3 = 123 and TABLEA.COLUMN1 = TABLEB.COLUMN2
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 2 Answers and 12 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE