Thread: returning multiple resultset?

returning multiple resultset?

From
iseyfi@vt.edu (ismail)
Date:
Hello all,

I am fairly new to PostgreSQL and I am right now converting a database
from SQL server. SQL server can return multiple select statements in
the function body. Is there any way to return a function with two
different resultsets?

select * from table1;


select * from table2;


Thanks for your time and help


Re: returning multiple resultset?

From
Tom Lane
Date:
iseyfi@vt.edu (ismail) writes:
> I am fairly new to PostgreSQL and I am right now converting a database
> from SQL server. SQL server can return multiple select statements in
> the function body. Is there any way to return a function with two
> different resultsets?

You can fake it in some cases by returning opened cursors.  See the
plpgsql docs' discussion of working with cursors.  Of course this will
only work for resultsets that you can specify as a SQL query.
        regards, tom lane