Solved

PL/SQL update with joining other tables

Posted on 2010-08-18
2
361 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

Don't miss ATEN at NAB Show April 24-27!

Visit ATEN at NAB Show to learn how our "Seamlessly Entertaining" solutions deliver fast, precise video streaming without delays for the broadcasting and media environment. ATEN will showcase its 16x16 Modular Matrix Switch (VM1600) and KVM Over IP Solution (KE6900 series).

Question has a verified solution.

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

Suggested Solutions

Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to recover a database from a user managed backup

749 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