Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple SQL update
> I'm trying to do an update in Oracle 9i that seems like it should be very
> simple but I can't figure out the syntax. The update needs to use a
> different formula Dependant on the current value of the attribute.
> Simplified:
>
> UPDATE MyTable Set F1 = (F1 > 1) * 2 + 1 ;
>
> This returns a missing right parenthesis error.
>
> As does
> Select (2>1) FROM dual ;
>
> How do I put the comparison into the calculation?
> Randy Harris
> tech at promail dot com
> I'm pretty sure I know everything that I can remember.
hello Randy,
The F1 > 1 comparison probably needs to go into the where clause :
UPDATE MyTable Set F1 = (F1 * 2) + 1
where F1 > 1 ;
Is that what you mean to do ? Otherwise look into the CASE function.
cheers,
Roelof Schierbeek; DBA Received on Sun Aug 13 2006 - 12:11:16 CDT
![]() |
![]() |