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: UPDATE query problem

Re: UPDATE query problem

From: hpuxrac <johnbhurley_at_sbcglobal.net>
Date: Fri, 29 Jun 2007 18:16:27 -0700
Message-ID: <1183166187.876588.214360@o61g2000hsh.googlegroups.com>


On Jun 29, 5:42 pm, "Syltrem" <syltremz..._at_videotron.ca> wrote:
> Hi
>
> I'm trying to update 2 columns in a table, with values that exist in the
> same table under a different key value.
> The select ion of rows in the table to update, is made by matching key
> columns from a cross reference table.
> Only those rows that exist in the XREF table mnust be updated
>
> Table XREF:
> KEYVAL1
> KEYVAL2
> DESCRIPTION
> HELPTEXT
>
> Table to be updated:MYTABLE
> KEYVAL
> DESCRIPTION
> HELPTEXT
>
> I must take the DESCRIPTION and HELPTEXT from MYTABLE where MYTABLE.KEYVAL
> = XREF.KEYVAL1, and update this value in MYTABLE where
> MYTABLE.KEYVAL=XREF.KEYVAL2
>
> I can`t find a way to do this except by doing PL/SQL
>
> Can this be done in a single SQL query ?
>
> Thanks !
>
> Syltrem
> Oracle 10gR2 on VMS

update table mytable set col1 = ( select query1 that you need ), col2 = ( select query2 that you need ) where mytable.keyval = ( select query3 that you need )

Are you getting an error message with syntax like that above?

What exactly do you have for SQL when you attempt to do it all in 1 query? Received on Fri Jun 29 2007 - 20:16:27 CDT

Original text of this message

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