Re: I want to use arithmetic operator ">" in function "Decode"

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Tue, 09 Oct 2001 20:51:42 +0100
Message-ID: <3BC3554E.3F34_at_yahoo.com>


Ryan Park wrote:
>
> Hi,
>
> See below SQL statement
>
> SELECT DECODE (TO_NUMBER('1'), 1, 'T', 'F' ) FROM DUAL
>
> As you could guess, this works well...Then how about next one?
>
> SELECT DECODE (:A > 1, 1, 'T', 'F' ) FROM DUAL
>
> OR
>
> SELECT DECODE (10 > 1, 1, 'T', 'F' ) FROM DUAL
>
> OR
>
> SELECT DECODE ((10>1), 1, 'T', 'F' ) FROM DUAL
>
> All these makes error "ORA-00907:missing right parenthesis.".
>
> I wonder why these are not allowed under oracle 8.0.
>
> Is this impossible?
>
> If any of you have a idea to enable this expression, plz let me know.
>
> Thanks in advance.
>
> Regards,
> Ryan
>
> -p.s
>
> As for my opinion:
>
> I've searched all Oracle documents and found that
>
> (:A>10) or (10>0) are not "Expressions" and so these are not allowed
> to
>
> be used as a first parameter of "Decode" function.
>
> If this is the "right" reason of error I think Oracle should allow
> this..Isn't it? :-)
>
> BTW, is this the "right" reason?

You can use CASE if you're on a recent version, SIGN in the decode before that.

hth
connor

-- 
==============================
Connor McDonald

http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue..."
Received on Tue Oct 09 2001 - 21:51:42 CEST

Original text of this message