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: tricky sql question

Re: tricky sql question

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/05/28
Message-ID: <338b7b2f.933151@newshost>#1/1

On Tue, 27 May 1997 22:30:33 GMT, breitliw_at_netcom.ca (Wolfgang Breitling) wrote:

>Does anyone know a nifty way of writing an update sql where the qualifying
>rows are determined by matching the multicolumn prime key with values
>returned from a subselect. This is one way, but it this way oracle doesn't use
>any indexes:
>
>update tbl_a set some_column = value
>where key1 || key2 in (select key1 || key2 from tbl_b
>where other_column = xyz )
>

how about

update tbl_a set some_column = value
where ( key1, key2 ) in ( select key1, key2 from tbl_b

                           where other_column = xyz )
/

[snip]

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed May 28 1997 - 00:00:00 CDT

Original text of this message

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