Re: Multiple Resultsets

From: Joe Conway <mail(at)joeconway(dot)com>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: Michael Guerin <guerin(at)rentec(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Multiple Resultsets
Date: 2003-07-07 15:16:38
Message-ID: 3F098ED6.3040101@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Bruno Wolff III wrote:
> On Mon, Jul 07, 2003 at 10:04:26 -0400,
> Michael Guerin <guerin(at)rentec(dot)com> wrote:
>
>>Does anyone know if PostgreSQL can support functions that return
>>multiple results sets like SQL Server stored procedures.
>
> Yes it can. I think you want to use at least 7.3 for that feature.
> My memory is that there was something you could do in 7.2, but that
> it doesn't work nearly as well as what is available for 7.3.
>

Um, except for the *multiple* part. MS SQL Server allows a stored
procedure call like this:

exec sp_my_stored_procedure

and that will "project" one or more results sets to the front end. Those
results cannot be qualified or joined with other data.

In Postgres 7.3 (and up) you can create a "table function" which is a
function that can be used in the FROM clause, just like a table. It can
be qualified and joined with other FROM clause sources; e.g.:

select * from my_table_function();

However, it cannot return multiple results sets.

HTH,

joe

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Brad Rhine 2003-07-07 16:06:08 Groups and Users
Previous Message Volker Krey 2003-07-07 15:09:49 inheritance