Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple SQL update

Re: Simple SQL update

From: R. Schierbeek <bytelifeNospam_at_gmail.com>
Date: Sun, 13 Aug 2006 19:11:16 +0200
Message-ID: <44df5c91$0$87195$dbd4d001@news.wanadoo.nl>

> 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

Original text of this message

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