Pavel Stehule wrote:
CREATE OR REPLACE FUNCTION foo(integer, integer) RETURNS integer AS $$
BEGIN
RETURN $1 + $2;
END; $$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION foo(integer) RETURNS integer AS $$
BEGIN
RETURN foo($1,10); -- 10 is "default" value
END; $$ LANGUAGE plpgsql;
Note that if you
> I am running postgres on a Linux system and have been using plpgsql to
> write functions. Is there a way to specify default arguments?
Hello,
there is no possibility define default arguments. But you can write
functions with different count of arguments.
CREATE OR REPLACE FUNCTION foo(int
Hello-
I am running postgres on a Linux system and have been using plpgsql to
write functions. Is there a way to specify default arguments? For
example, I would like to offer the user to specify a date to use in my
function but if no date is specified I would like to use the current
date. Ea