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

Home -> Community -> Usenet -> c.d.o.server -> Update table with contents from another table

Update table with contents from another table

From: David Manero <davidman73_at_hotmail.com>
Date: 8 Jul 2004 12:02:48 -0700
Message-ID: <35c81099.0407081102.2530fd8d@posting.google.com>


Hi,

The way to update a table with contents from another is always shown like this:
Update T_A
Set C1 = (Select C2 from T_B where ...)

Now, if I need to update 4 columns in T_A, am I supposed to create 4 subqueries? Sounds like inefficient to me...

This is what I'm doing but not sure if there's a better way:

Update (Select T_A.C1, T_A.C2 ..., T_B.C2, T_B.C3

        FROM T_A, T_B
        WHERE ...)

SET T_A.C1=T_B.C2,
    T_A.C2 = T_B.C3, ...

Am I doing it right? Any ideas/suggestions?

Thanks,

David Received on Thu Jul 08 2004 - 14:02:48 CDT

Original text of this message

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