Re: Function Parameters - need help !!!

Поиск
Список
Период
Сортировка
От Phil Endecott
Тема Re: Function Parameters - need help !!!
Дата
Msg-id 2733210@chezphil.org
обсуждение исходный текст
Ответ на Re: Function Parameters - need help !!!  ("Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar.Pyatalo@honeywell.com>)
Список 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.


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Pradeepkumar, Pyatalo (IE10)"
Дата:
Сообщение: Re: Function Parameters - need help !!!
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Function Parameters - need help !!!