Solved

PL/SQL update with joining other tables

Posted on 2010-08-18
2
362 Views
Last Modified: 2013-12-19
I am trying to do a simple update statement in PL/SQL, Oracle 9i.

Table A
col1    col2     col3
1         1          Y
2         1          N
3         1          

Table B
col1    col2    col3
1         1         Y
2         1         Y
3         1         Y

All I need to do is the update Table B col3  the same as in Table A col3, if Table A col3 is null, then update as N.

I know oracle doesn't have the update from like SQL Server.  This makes it very difficult for me.  Please help.  Thanks.
0
Comment
Question by:cmleung2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 33470278
update
 (select b.col1, b.col2, a.col3 as col3a, b.col3 as col3b
  from tableb b left join tablea a on a.col1=b.col1 and a.col2=b.col2) t
set
 t.col3b=nvl(t.col3a, 'N')
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 33470313
update tableB b
set col3 = nvl((select col3 from tableA a where a.col1=b.col1 and a.col2=b.col2),'N')
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
During and after that shift to cloud, one area that still poses a struggle for many organizations is what to do with their department file shares.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question