Re: Returning more than one value from a stored procedure

Поиск
Список
Период
Сортировка
Искать
От
Thomas Kellerer
Тема
Re: Returning more than one value from a stored procedure
Дата
Msg-id
i14dm0$c6o$1@dough.gmane.org
Ответ на
Список
Дерево обсуждения
Re: Returning more than one value from a stored procedure Tim Landscheidt <tim@tim-landscheidt.de>
Atif Jung, 08.07.2010 11:51:
> Hi,
> I'm having difficulty working out the correct syntax to return more than
> one value from a stored procedure. I wish to return an INTGER and a string
> CREATE or REPLACE FUNCTION testproc(val1 (CHAR9), val2 CHAR(4)) RETURNS
> INTEGER, CHAR(640) AS $$
> The above is incorrect but what is the correct syntax?
> Thanks
>
> Atif
>
>

If you don't need the power of pl/pgSQL to calculate your result, a simple SQL function should work:

CREATE OR REPLACE FUNCTION testproc(val1 char(9), val2 char(4))
RETURNS TABLE(id integer, some_value text)
AS
$$
   SELECT 42, 'your value'::text;
$$
LANGUAGE sql;


В списке pgsql-novice по дате отправления
От: A. Kretschmer
Дата:
От: Thomas Kellerer
Дата:
FAQ