PL/SQL-Function RETURN-Type

From: Marit Hansen <marit_at_pz-oekosys.uni-kiel.d400.de>
Date: 22 Nov 1993 14:36:39 GMT
Message-ID: <marit.24.0_at_pz-oekosys.uni-kiel.d400.de>


Hi!

I use ORACLE Forms 4.0 (with PL/SQL 2.0-Program Units). Now I would like to have a function like

  FUNCTION Id_To_Name( id IN VARCHAR2 )
  RETURN VARCHAR2
  IS
  BEGIN
    IF id = '0' THEN
      RETURN 'MASTER';
    ...
    END IF;
  END; /* Id_To_Name */

You see that the RETURN-parameter is a string (longer than one character). Each time the IF-clause evaluates to TRUE, I get a VALUE ERROR.

If I change the RETURN-output to a one-character-string (e.g. 'M'), everything works fine.

Concerning the manual, the RETURN-datatype isn't restricted. The compiler doesn't allow to specify the length of the parameter (e.g. VARCHAR2(10)). Of course I can substitute the function by a procedure and a global variable, but is there another way?

                Marit Received on Mon Nov 22 1993 - 15:36:39 CET

Original text of this message