Re: Functions returning multiple rowsets

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Functions returning multiple rowsets
Date: 2009-09-28 17:29:20
Message-ID: 162867790909281029v967ed09geaa202041c58a79@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

2009/9/28 Thom Brown <thombrown(at)gmail(dot)com>:
> Hi,
>
> Is it possible to create a function using 'SQL' as language which could
> return multiple rowsets, such as "SELECT * FROM TABLE1; SELECT * FROM
> TABLE2;" where both results are returned in the output?  I know this can be
> done in stored procedures in other RBDMS but can this be done in a function?
>

it is possible, but not directly. You can returns setof refcursors

see http://www.postgresql.org/docs/8.2/static/plpgsql-cursors.html

regards
Pavel Stehule

> Thanks
>
> Thom
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2009-09-28 17:58:39 Re: computed values in plpgsql
Previous Message Reid Thompson 2009-09-28 17:29:18 Re: computed values in plpgsql