Home » SQL & PL/SQL » SQL & PL/SQL » coalesce puzzle
coalesce puzzle [message #241116] Mon, 28 May 2007 06:51 Go to next message
orafacjublu
Messages: 95
Registered: May 2006
Location: KOLKATA
Member
We all know that coalesce is a SQL function that returns the first non-null expression in the list

Syntax : coalesce (exp1,exp2,......expn);

My question is can anybody answer what type of function overloading is this coalesce function so that you can use n Laughing number of arguments while calling this function .
Re: coalesce puzzle [message #241128 is a reply to message #241116] Mon, 28 May 2007 07:29 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
That's an excellent question, and one to which I wish I knew the answer.

My guess is that there are two types of functions: the ones Oracle lets us write (PL/SQL - the same sort they supply plenty of in Supplied Packages) and ones that are part of the internal SQL engine. The second sort all have function-specific parse-code in the SQL engine; the first type uses a generic bog-standard parser based on the function defs.

This is nothing new of course, DECODE has been doing it ever since I first touched Oracle (v5.1b). I reckon that's just about gotta be before the term "overloading" was coined.

Dontcha just wish you could write your own functions like that?

Ross Leishman
Re: coalesce puzzle [message #241275 is a reply to message #241128] Tue, 29 May 2007 01:36 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
COALESCE function is part of STANDARD package.
STANDARD package has/is a direct interface to C functions.
It is just a wrapper, no PL/SQL.

Regards
Michel
Re: coalesce puzzle [message #241335 is a reply to message #241275] Tue, 29 May 2007 05:09 Go to previous messageGo to next message
orafacjublu
Messages: 95
Registered: May 2006
Location: KOLKATA
Member
Coalesce may be a c function then how it is using n number of arguments
Re: coalesce puzzle [message #241358 is a reply to message #241335] Tue, 29 May 2007 06:15 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
As any other C function.
Do you ask how to do it in C?

Regards
Michel
Re: coalesce puzzle [message #241527 is a reply to message #241358] Tue, 29 May 2007 21:48 Go to previous message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Writing a VARARGS function in C
Previous Topic: dbms_sql and save exception
Next Topic: Autonomous Transactions
Goto Forum:
  


Current Time: Thu Dec 08 23:51:36 CST 2016

Total time taken to generate the page: 0.05808 seconds