Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Column updating problem

Re: Column updating problem

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Tue, 24 Jan 2006 07:24:36 +0100
Message-ID: <43d5c823$0$9000$626a54ce@news.free.fr>

<inlove22_at_hotmail.com> a écrit dans le message de news: 1138081707.303476.304170_at_f14g2000cwb.googlegroups.com...
| Hello,
|
| Lets say I have two tables A and B which both have the same columns PK
| ,col1, col2, col3.
| In table A there is only data in col1.The col2 and col3 columns will
| updated using the data from Table B (the tables will be joined using
| the PK column).
|
| So here is the dilenma. How do i update Table A so that I retain the
| col1 values even though Table B may not have all the col1 values and
| still update Table A's col2 and col3 with the Table B data??
|
| Table A
| PK col1 col2 col3
| 123 abc .. ..
| 234 def .. ..
| 567 ghi .. ..
|
| Table B
| PK col1 col2 col3
| 123 abc y n
| 234 n
| 567 .. y
|
| Updated Table A
| PK col1 col2 col3
| 123 abc y n
| 234 def n ..
| 567 ghi .. y
|
|
| Thanks,
|
| Thanos
|

update (select a.pk, a.col2 col2a, a.col3 col3a, b.pk, b.col2 col2b, b.col3 col3b

        from tableA a, tableB b where a.pk = b.pk) set col2a = col2b, col3a = col3b
/

Regards
Michel Cadot Received on Tue Jan 24 2006 - 00:24:36 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US