Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Datatype in stored functions
Noons wrote:
> "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.nospam
Noons is correct. Don't forget that you can query all_tab_columns for data type information.
-- Daniel Morgan http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Mon Aug 18 2003 - 11:02:39 CDT