Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Datatype in stored functions
On Mon, 18 Aug 2003 15:38:29 +0200, "Hans Sauren"
<hsauren_at_gruen-ag.de> wrote:
>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?
>
>Thanks for any suggestion
>Hans Sauren
>
>
Hi Hans,
Nuno has already shown you the correct and safest way to do it, but :
You *could* also take advantage of Oracle's abilities regarding implicit conversions :
SQL> create or replace function nullcheck(par varchar2) return boolean
2 is
3 begin
4
5 return (par is null);
6
7 end nullcheck;
8 /
Funktion er oprettet.
SQL> SQL> set serveroutput on size 1000000; SQL> begin
only null is null