Thread: umlimited arguments on function

umlimited arguments on function

From
Christian Hergert
Date:
Is it possible to write a function (in sql or plpgsql) that allows for an unknown amount of arguments? Something
similarto C's printf() function.<br /><br /> ~ chris  

Re: umlimited arguments on function

From
Robert Treat
Date:
On Monday 09 February 2004 14:49, Christian Hergert wrote:
> Is it possible to write a function (in sql or plpgsql) that allows for
> an unknown amount of arguments? Something similar to C's printf()
> function.
>

AFAIK no, but I know of two possible work arounds... first is to write 
multiple copies of the function to accept the different number of argument 
combinations you need.  the other thing i've done in the past is to create 
the function as accepting a array as one of its inputs and then handle the 
array structure as needed. (bonus points for doing the second method in 7.3 
where its much more challenging.)  HTH,

Robert Treat
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL