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: Correlated updates.

Re: Correlated updates.

From: SUVAS LAKSHMIKUTTYAMMA <lsuvas_at_worldnet.att.net>
Date: 1997/12/09
Message-ID: <66ilmt$4b0@bgtnsc02.worldnet.att.net>#1/1

update a
set Ref =( select Newref from b

             where a.Ref=b.Oldref);

NB: This is a correlated sub query and it updates every row in table a

       by evaluating the sub query each time for a row.

Mark Hunter <mark_at_se7en.demon.co.uk> wrote in article <348a688e.266552_at_news.demon.co.uk>...
> I wonder if you could help me with a piece of SQL?
>
> TableA has a column called Ref, which is unique.
> TableB has columns called Oldref and Newref.
>
> For every value of TableA( Ref) there is a corresponding value in
> TableB( Oldref)
>
> I wish to update every row in TableA so that the value of Ref is
> updated to Newref (as listed in TableB).
>
>
> Suggestions please.
> Mark Hunter
> http://www.se7en.demon.co.uk
>
Received on Tue Dec 09 1997 - 00:00:00 CST

Original text of this message

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