Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Can you use a decode with the SET clause of UPDATE statement
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