Search Postgresql Archives

Re: plpgsql functions

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

 



On 15/08/2008 20:12, c k wrote:
Hi,
I am getting an error for a function written in plpgsql, as -

CREATE OR REPLACE FUNCTION uf_accgroupbal(date, date, p_company integer)
  RETURNS SETOF uf_closingbal AS

<snip>

For functions return SETOF any type, you need to use the following idiom:

...
declare
  rec yourtype;
begin
  for rec in [your query here...]
  loop
    return next rec;
  end loop;
  return;
end;
...

See the docs on control structures in pl/pgsql.

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