Re: "decode" the boolean value retruned from a stored function

From: Lun Wing San <wslun_at_hkpc.org>
Date: 1996/11/14
Message-ID: <328B963B.70DA_at_hkpc.org>#1/1


Vahidt A. Tadjkarimi wrote:
>
> I am trying to use the "decode" fuction to interpreat a returned
> bololean value from a store function to a char, but not much luck!
> Here is the example:
>
> create or replace function PLUS_MINUS_BO (VAL1 in number, VAL2 in
> number) return boolean
> is
> begin
> retrun ((abs(val1 - val2)/val1) > .2);
> end PLUS_MINUS_BO;
> /
>
> Now, when I execute the following "select":
>
> sql> select decode(PLUS_MINUS_BO(2,3), TRUE, '+', '-') from dual;
>
> I get:
>
> ERROR at line 1:
> ORA-00904: invalide column name
>
> Any hints?!

  It was because TRUE is not a text literal, number. It is interpreted as a column name in this case.

-- 
Name        : Lun Wing San
Title       : Oracle developer of the Hong Kong Productivity Council
              System Administrator and Oracle DBA of the Quick Response
Center
Email Addr. : sunny_at_hkpc.org
Telephone   : 852-2788-5841
Received on Thu Nov 14 1996 - 00:00:00 CET

Original text of this message