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: Can you use a decode with the SET clause of UPDATE statement

Re: Can you use a decode with the SET clause of UPDATE statement

From: Hans Forbrich <forbrich_at_yahoo.net>
Date: Mon, 02 Aug 2004 16:11:35 GMT
Message-ID: <XItPc.15584$hw6.11321@edtnps84>


Roy Munson wrote:

> Each,
>
> Can you use a decode like so....
>
> update table
> set decode(field_a, value_1, field_b, field_c) = value_2;
>
> Compiler says not....wanting to update either field_b or field_c
> depending on the value of field_a.
>
> What say you?

You're thinking it backwards. Decode returns a VALUE not an IDENTIFIER

As far as I can tell, there is no support for returning identifiers in the SQL standard. Therefore you need to specify each 'field' separately and come up with a decode (or other expression) that returns either the replacement or the current value. Received on Mon Aug 02 2004 - 11:11:35 CDT

Original text of this message

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