Re: out parameters and SETOF

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: out parameters and SETOF
Дата
Msg-id 20060119232910.GA16741@winnie.fuhr.org
обсуждение исходный текст
Ответ на out parameters and SETOF  (Jaime Casanova <systemguards@gmail.com>)
Ответы Re: out parameters and SETOF  (Jaime Casanova <systemguards@gmail.com>)
Список pgsql-general
On Thu, Jan 19, 2006 at 04:03:41PM -0500, Jaime Casanova wrote:
> there is a way to use OUT parameters in conjunction with SETOF?

Do you want to return a set of the OUT parameters or a set of
something else?  I don't think you can do the latter; for the former
use SETOF record:

CREATE FUNCTION foo(OUT x integer, OUT y integer)
RETURNS SETOF record AS $$
BEGIN
    x := 1; y := 2; RETURN NEXT;
    x := 3; y := 4; RETURN NEXT;
    x := 4; y := 5; RETURN NEXT;
END;
$$ LANGUAGE plpgsql;

SELECT * FROM foo();
 x | y
---+---
 1 | 2
 3 | 4
 4 | 5
(3 rows)

--
Michael Fuhr

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Upgrade Problem: 7.4.3 -> 8.1.2
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Upgrade Problem: 7.4.3 -> 8.1.2