Multiple Resultsets
Multiple Resultsets
От:
Michael Guerin <guerin@rentec.com>
Дата:
Does anyone know if PostgreSQL can support functions that return multiple results sets like SQL Server stored procedures.
Re: Multiple Resultsets
От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Mon, Jul 07, 2003 at 10:04:26 -0400, Michael Guerin 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.
Re: Multiple Resultsets
От:
Joe Conway <mail@joeconway.com>
Дата:
Bruno Wolff III wrote: > On Mon, Jul 07, 2003 at 10:04:26 -0400, > Michael Guerin 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