Home > Archive > Other Oracle database topics > October 2005 > A question on the NVL to be re cristchened to ISNULL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author A question on the NVL to be re cristchened to ISNULL
bhushanvinay@gmail.com

2005-10-20, 8:25 pm

wanted to know if the oracle supported a varient datatype as to write
a wraper to the nvl function, i discoverd that we cannot do a synonym
for a system functions like NVL but nvl supports a varient datatype or
it may have been designed to have a functin overloading concept in
oracle as its a object oriented database.

but how its developed is not my issue here can there be a varient
datatype which it accepts and get me the varient output.

CREATE OR REPLACE FUNCTION ISNULL( ARG1 VARIENT, ARG2 VARIENT)
RETURN VARIENT IS
RTNVAL VARIENT;
BEGIN
RETURN NVL(ARG1,ARG2);
END;
/
SHOW ERRORS;

any answers to this will be appriciated.

Regards
Vinay

Chris ( Val )

2005-10-20, 8:25 pm


bhushanvinay@gmail.com wrote:
> wanted to know if the oracle supported a varient datatype as to write
> a wraper to the nvl function, i discoverd that we cannot do a synonym
> for a system functions like NVL but nvl supports a varient datatype or
> it may have been designed to have a functin overloading concept in
> oracle as its a object oriented database.
>
> but how its developed is not my issue here can there be a varient
> datatype which it accepts and get me the varient output.
>
> CREATE OR REPLACE FUNCTION ISNULL( ARG1 VARIENT, ARG2 VARIENT)
> RETURN VARIENT IS
> RTNVAL VARIENT;
> BEGIN
> RETURN NVL(ARG1,ARG2);
> END;
> /
> SHOW ERRORS;
>
> any answers to this will be appriciated.


You haven't stated which version of Oracle you're using, but
9i introduced the 'anydata' data type which has a whole bunch
of methods to help you out.

desc anydata;

Cheers,
Chris Val

Jim Kennedy

2005-10-20, 8:25 pm


<bhushanvinay@gmail.com> wrote in message
news:1129741943.043149.305790@g44g2000cwa.googlegroups.com...
> wanted to know if the oracle supported a varient datatype as to write
> a wraper to the nvl function, i discoverd that we cannot do a synonym
> for a system functions like NVL but nvl supports a varient datatype or
> it may have been designed to have a functin overloading concept in
> oracle as its a object oriented database.
>
> but how its developed is not my issue here can there be a varient
> datatype which it accepts and get me the varient output.
>
> CREATE OR REPLACE FUNCTION ISNULL( ARG1 VARIENT, ARG2 VARIENT)
> RETURN VARIENT IS
> RTNVAL VARIENT;
> BEGIN
> RETURN NVL(ARG1,ARG2);
> END;
> /
> SHOW ERRORS;
>
> any answers to this will be appriciated.
>
> Regards
> Vinay
>


You can use function overloading. Just define a different function (same
name, but different datatypes) and it will work as advertised. Oracle will
choose the right one.
Jim


DA Morgan

2005-10-20, 8:25 pm

Jim Kennedy wrote:
> <bhushanvinay@gmail.com> wrote in message
> news:1129741943.043149.305790@g44g2000cwa.googlegroups.com...
>
>
>
> You can use function overloading. Just define a different function (same
> name, but different datatypes) and it will work as advertised. Oracle will
> choose the right one.
> Jim


Addendum: You can overload functions in packages and you can overload
functions in use-defined operators.
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)
Sybrand Bakker

2005-10-21, 1:23 pm

On 19 Oct 2005 10:12:23 -0700, bhushanvinay@gmail.com wrote:

>wanted to know if the oracle supported a varient datatype as to write
>a wraper to the nvl function, i discoverd that we cannot do


Please use the reference manual for doc questions.

--
Sybrand Bakker, Senior Oracle DBA
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com