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

From: Steve Long <steve-long_at_mediaone.net>
Date: Wed, 10 Oct 2001 01:07:13 GMT
Message-ID: <5bNw7.1111$Ry.6214_at_typhoon.jacksonville.mediaone.net>


well, 10 is always greater than 1, so you could just select 'T' from dual in these cases. however, for the :A > 1, you can do

select decode (sign(:A-1), 1, 'T','F') from dual;

hth

"Ryan Park" <bajy_at_intizen.com> wrote in message news:5016f0aa.0110090605.2f1da2ce_at_posting.google.com...
> 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?
Received on Wed Oct 10 2001 - 03:07:13 CEST

Original text of this message