On Mon, Jun 18, 2012 at 4:30 AM, utsav <utsav(dot)pshah(at)tcs(dot)com> wrote:
> Thanks for reply but you have used SQL as a language .
>
> Please give me Plpgsql example because i am facing problem in plpgsql only
create function f(foo out foo, bar out bar) returns setof
record as $$
begin
return query select (v, v::text)::foo, (v, v::text)::bar from
generate_series(1,3) v;
end
$$ language plpgsql;
-- or --
create or replace function f(foo out foo, bar out bar) returns setof
record as $$
begin
f.foo = (1,'a')::foo;
f.bar = (2,'b')::bar;
return next;
end
$$ language plpgsql;
(in older versions of postgres you might have to be a little more
careful about names of input and output arguments).
merlin