Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Function and Datatype Question

Function and Datatype Question

From: Tim Romano <tim_at_ot.com>
Date: 1997/02/03
Message-ID: <01bc11ef$64086920$7df0eac7@haven>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US