[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

PL/SQL update with joining other tables

Posted on 2010-08-18
2
Medium Priority
?
369 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
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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
In this article I will be showing you how to subnet the easiest way possible for IPv4 (Internet Protocol version 4). This article does not cover IPv6. Keep in mind that subnetting requires lots of practice and time.
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

834 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