Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Newbie : PL/SQL Function Return value
Thanks for your reply.
Here is an example of the what I'm using, which seems to be basically what you are suggesting, but when I use this function in the view creation, the resulting field is always VARCHAR2(4000). Would the NULL value cause a problem?
CREATE OR REPLACE FUNCTION TXLINK.Description(aType IN NUMBER)
RETURN VARCHAR2
IS
Temp VARCHAR2(30);
BEGIN
IF aType = 0 THEN
Temp := 'Undefined';
ELSIF aType = 1 THEN
Temp := 'High';
ELSIF aType = 2 THEN
Temp := 'Medium';
ELSIF aType = 3 THEN
Temp := 'Low';
ELSE
Temp := NULL;
END IF;
RETURN(Temp);
END Description;
Regards,
Lee.
>
> You can limit the size of a VARCHAR variable in PL/SQL, e.g.
>
> CREATE OR REPLACE FUNCTION myFunc (myString VARCHAR2) RETURN VARCHAR2
> IS
> returnString VARCHAR2(100);
> BEGIN
> -- do something
> returnString := UPPER(myString) || 'test';
> -- return string must not exceed 100 characters;
> RETURN returnString;
> END;
> /
>
>
> --
> Knut Lassmann myToys.de GmbH +49-30-72 62 01 411
> I had joy, I had fun, I had Pacman on a SUN(E3500).
Received on Tue Aug 15 2000 - 09:36:20 CDT
![]() |
![]() |