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 -> Re: help: many updates

Re: help: many updates

From: Howard J. Rogers <howardjr2000_at_yahoo.com.au>
Date: Sun, 23 Feb 2003 14:41:40 +1100
Message-ID: <pan.2003.02.23.03.41.39.908594@yahoo.com.au>


On Sat, 22 Feb 2003 03:57:47 +0000, charlie cs wrote:

> We are using 9.2.
> We need to update a big table like this
>
> SQL> update table test set colA='A' where colA_1='X';
> SQL> update table test set colB='B' where colB_1='Y';
> SQL> update table test set colC='C' where colC_1='Z';
>
> .....
>
> Is there any way we can do this in one sql, instead of making several
> database calls?
>
> Thanks for you help.

The closest I can think of is the new 9i MERGE statement, which says 'if this record is found in table 1, update it so it matches the values in table 2. Otherwise, insert it into table 1 as a brand new record'.

Which isn't exactly what you want, because you appear to want to update table test's columns with some entirely NEW value if table 2 has a particular value.

But maybe there are ways you can adapt the syntax to do what you want.

Regards
HJR Received on Sat Feb 22 2003 - 21:41:40 CST

Original text of this message

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