Search Postgresql Archives

plpgsql returning resultset

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

 



Hi

I know the subject has been discussed before, but I dont find what any
information that helps me make it work, so please bear with me.

In pg 8.2 I want to write a function that gathers data from different
tables and joins it into a single resultset, similar to "select * from
tableA", but the problem I keep having is that I cant get the return to
work. I have tried return next and it fails. I have also tried refcursor,
but am not sure if that is the best way, its a littlebit cumbersome in a
program.

Are those the only two options? and what did I do wrong in the return next

create function test2() returns setof record as
$$
declare
   val_list record;
begin

   select * into val_list from tableA;
   return next val_list;
   return:
end
$$ .....


with the query:
    select test2();

ERROR: set-valued function called in context that cannot accept a set
CONTEXT: line 9 at return next

regards thomas



[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