Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Function and Datatype Question
I'm trying to create a function and use it in a SELECT statement. However, the function returns a Boolean and it would seem that the function must return a value of the database of the underlying column, which doesn't make sense to me. Here's an example:
CREATE FUNCTION ISNULL(MYVAL IN VARCHAR2) RETURN BOOLEAN IS
bResult BOOLEAN;
BEGIN
IF MYVAL IS NULL THEN
bResult := TRUE;
ELSE
bResult := FALSE;
END IF;
RETURN (bResult);
END;
Now, if I do this (PO7 for Windows):
SELECT ID, ISNULL(DESC) FROM MYTABLE I get an error that the expression is the wrong datatype. If I change the BOOLEAN to VARCHAR2 and set bResult to 'Y' or 'N' accordingly, the function works.
Is there something obvious that I'm doing wrong?
Thanks,
Tim
Received on Mon Feb 03 1997 - 00:00:00 CST
![]() |
![]() |