On 08/15/2010 07:57 AM, zhong ming wu wrote:
> Here is what I have tried
> 
> create or replace function te(out a int,out b int) returns setof record as
> $pgsql$
> declare
> r record;
> begin
> r.a := 1;
> r.b := 2;
> return next;
> end;
> $pgsql$ language plpgsql;

Try:

create or replace function te(out a int,out b int)
returns setof record as $pgsql$
  begin
    a := 1;
    b := 2;
    return next;
  end;
$pgsql$ language plpgsql;

contrib_regression=# select * from te();
 a | b
---+---
 1 | 2
(1 row)

-- or --

create or replace function te()
returns TABLE(a int, b int) as $pgsql$
  begin
    a := 1;
    b := 2;
    return next;
  end;
$pgsql$ language plpgsql;

contrib_regression=# select * from te();
 a | b
---+---
 1 | 2
(1 row)



HTH,

Joe

-- 
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to