Re: plpgsql returning resultset

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: plpgsql returning resultset
Дата
Msg-id 48BD1639.7050401@iol.ie
обсуждение исходный текст
Ответ на plpgsql returning resultset  (tfinneid@student.matnat.uio.no)
Ответы Re: plpgsql returning resultset  (tfinneid@student.matnat.uio.no)
Список pgsql-general
On 02/09/2008 11:12, tfinneid@student.matnat.uio.no wrote:

> create function test2() returns setof record as
> $$
> declare
>    val_list record;
> begin
>    select * into val_list from tableA;
>    return next val_list;
>    return:
> end
> $$ .....

Hi there,

You need to do it like this:

    with val_list in
      select * from tableA do
    loop
      return next val_list;
    end loop;
    return;

There's an example here:

http://www.postgresql.org/docs/8.3/static/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: immutable functions and enumerate type casts in indexes
Следующее
От: tfinneid@student.matnat.uio.no
Дата:
Сообщение: Re: plpgsql returning resultset