pgsql procedures??

Started by Maurício Paivaover 22 years ago4 messages
#1Maurício Paiva
mauricio@acesso-online.com.br

What we are trying to figure out is if postgresql supports
returning multiple result sets from a stored procedure (psql
function?)

For example in MSSQL's Northwind database you can create the
following stored procedure:

<mssql-proc>
CREATE PROCEDURE "test"
AS
SELECT * FROM Orders
SELECT * FROM Customers
GO
</mssql-proc>

This would return two datasets from the procedure.
We are unsure as to how to map this in to a pgsql equivalent.

#2Bruno Wolff III
bruno@wolff.to
In reply to: Maurício Paiva (#1)
Re: pgsql procedures??

On Wed, Sep 24, 2003 at 20:21:20 -0300,
Maur�cio Paiva <mauricio@acesso-online.com.br> wrote:

What we are trying to figure out is if postgresql supports
returning multiple result sets from a stored procedure (psql
function?)

No, Postgres can't do that.

#3Nigel J. Andrews
nandrews@investsystems.co.uk
In reply to: Bruno Wolff III (#2)
Re: pgsql procedures??

On Thu, 25 Sep 2003, Bruno Wolff III wrote:

On Wed, Sep 24, 2003 at 20:21:20 -0300,
Maurício Paiva <mauricio@acesso-online.com.br> wrote:

What we are trying to figure out is if postgresql supports
returning multiple result sets from a stored procedure (psql
function?)

No, Postgres can't do that.

But it can if you switch to one of the other languages like plpgsql, which
isn't terribly complicated but does require the language to be installed in the
database.

--
Nigel J. Andrews

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruno Wolff III (#2)
Re: pgsql procedures??

Bruno Wolff III <bruno@wolff.to> writes:

On Wed, Sep 24, 2003 at 20:21:20 -0300,
Maur�cio Paiva <mauricio@acesso-online.com.br> wrote:

What we are trying to figure out is if postgresql supports
returning multiple result sets from a stored procedure (psql
function?)

No, Postgres can't do that.

You might be able to fake it by returning multiple cursors, however.

regards, tom lane