Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Datatype in stored functions
"Hans Sauren" <hsauren_at_gruen-ag.de> wrote in message news:bhqksm$gpr$1_at_online.de...
> Hi all,
> we have to write a stored function which tests whether a value is NULL or 0
> or spaces in charfields. We want to give the function a parameter with the
> content of the field (or possibly the result of a term). Therefore the
> datatype of the parameter is undetermined or like SQL_VARIANT in Microsoft
> SQL Server). How can we implement this in ORACLE 8.1.7?
>
You don't. You use function overloading. As in:
CREATE FUNCTION A (par1 NUMBER) as
...
END A;
CREATE FUNCTION A (par1 VARCHAR) as
...
END A;
CREATE FUNCTION A (par1 CHAR) as
..
END A;
and you put the appropriate code in each of the ellipsis.
then you call them with the same "A" name and whatever parameter you want to test.
HTH
-- Cheers Nuno Souto wizofoz2k_at_yahoo.com.au.nospamReceived on Mon Aug 18 2003 - 08:44:17 CDT