From: | "Phil Endecott" <spam_from_postgresql_sql(at)chezphil(dot)org> |
---|---|
To: | "Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar(dot)Pyatalo(at)honeywell(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Function Parameters - need help !!! |
Date: | 2004-06-21 11:52:48 |
Message-ID: | 2733210@chezphil.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
Quote from Section 37.11 of the manual:
# There are no default values for parameters in PostgreSQL.
# You can overload function names in PostgreSQL. This is often used
to work around the lack of default parameters.
So for your example:
> CREATE FUNCTION test(integer,integer) RETURNS INTEGER AS '
> ...
you should be able to write:
CREATE FUNCTION test(integer) RETURNS INTEGER AS '
BEGIN
test($1, default_value_for_param2);
END;
' LANGUAGE 'plpgsql';
and also:
CREATE FUNCTION test() RETURNS INTEGER AS '
BEGIN
test(default_value_for_param1);
END;
' LANGUAGE 'plpgsql';
Hope this is what you were looking for.
--Phil.
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2004-06-21 11:54:35 | Re: Function Parameters - need help !!! |
Previous Message | Pradeepkumar, Pyatalo (IE10) | 2004-06-21 10:48:10 | Re: Function Parameters - need help !!! |