Search Postgresql Archives

Re: plpgsql returning resultset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/09/2008 11:12, tfinneid@xxxxxxxxxxxxxxxxxxxxx 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@xxxxxx
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux