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: Query from SQL SErver

Re: Query from SQL SErver

From: Lothar Armbruester <lothar.armbruester_at_t-online.de>
Date: Thu, 10 Oct 2002 18:17:29 +0200
Message-ID: <PM0003ACA8F83FED4A@hades.none.local>


PABLO wrote:
> Hi, I am trying to migrate this query from SQL server to Oracle 9i and
> I can not find a way to solve it.
>
> Does someone have and idea of how to do it ?
>
> Thanks a lot in advance.
> Pablo
>
> UPDATE Table1
> SET FieldA = b.FieldB
> FROM ( SELECT Exp as FIledB, Exp as FieldC FROM ... WHERE.... ) As B
> WHERE Table1.FieldA <> b.FieldB
> AND Table1.Field> >= b.fieldC

Hello Pablo,
you could try something like this:

update

   (select a.*,exp1 fieldb, exp2 fieldc
    from

       tablea a,
       ....
    where
       a.fielda<>exp1 and
       a.fielda>=exp2 and
       ...) set

   fielda=fieldb;

This only works if the primary key of tablea is also a key for the whole join. (Have a look at the docs under "key preserved")

Hope that helps,
Lothar

-- 
Lothar Armbrüster       | la_at_oktagramm.de
Hauptstr. 26            | la_at_heptagramm.de
D-65346 Eltville        | lothar.armbruester_at_t-online.de
Received on Thu Oct 10 2002 - 11:17:29 CDT

Original text of this message

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