Re: Calling PL functions with named parameters

Поиск
Список
Период
Сортировка
От Andreas Pflug
Тема Re: Calling PL functions with named parameters
Дата
Msg-id 411E4DCE.2050006@pse-consulting.de
обсуждение исходный текст
Ответ на Re: Calling PL functions with named parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> David Fetter <david@fetter.org> writes:
> 
>>CREATE OR REPLACE FUNCTION foo_func(name TEXT, val INTEGER) AS ...
> 
> 
>>SELECT foo_func(val AS 23, name AS 'Name goes here');
> 
> 
> I don't think that syntax will work.  You could possibly do it the other
> way round:
> 
> SELECT foo_func(23 AS val, 'Name goes here' AS name);
> 
> which would have some commonality with SELECT's column-labeling syntax
> but otherwise seems to have little to recommend it.  Are there any other
> vendors supporting such things in SQL, and if so how do they do it?

MSSQL's syntax for calling named parameters is like this:

CREATE PROCEDURE SampleProcedure @EmployeeIDParam INT,@MaxQuantity INT OUTPUT AS ...

DECLARE @MaxQtyVariable INT
EXEC @rc = SampleProcedure @EmployeeIDParam = 9,@MaxQuantity = @MaxQtyVariable OUTPUT

This is commonly used if a parameter should be left default (and I don't 
like it).

Regards,
Andreas


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: will PITR in 8.0 be usable for "hot spare"/"log shipping" type of replication
Следующее
От: Tom Lane
Дата:
Сообщение: Re: 7.4 backpatches