Re: functions are returns columns

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: functions are returns columns
Дата
Msg-id 878x55dhau.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: functions are returns columns  (Michele Petrazzo - Unipex srl <michele.petrazzo@unipex.it>)
Ответы Re: functions are returns columns
Список pgsql-sql
"Michele Petrazzo - Unipex srl" <michele.petrazzo@unipex.it> writes:

> I try with:
> CREATE FUNCTION getfoo (IN int, OUT int, OUT int) AS $$
>    SELECT fooid, foosubid FROM foo WHERE fooid = $1;
> $$ LANGUAGE SQL;
>
> but only one row returned...

You're almost there:

CREATE FUNCTION getfoo (IN int, OUT int, OUT int) returns setof record(int,int) AS $$ SELECT fooid, foosubid FROM foo
WHEREfooid = $1;
 
$$ LANGUAGE SQL;

The return type if present has to match the OUT (and BOTH) parameters.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Get trained by Bruce Momjian - ask me about
EnterpriseDB'sPostgreSQL training!
 


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

Предыдущее
От: Michele Petrazzo - Unipex srl
Дата:
Сообщение: Re: functions are returns columns
Следующее
От: Tom Lane
Дата:
Сообщение: Re: functions are returns columns