Thread: pgsql procedures??

pgsql procedures??

From
Maurício Paiva
Date:
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.

Re: pgsql procedures??

From
Bruno Wolff III
Date:
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.


Re: pgsql procedures??

From
"Nigel J. Andrews"
Date:
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



Re: pgsql procedures??

From
Tom Lane
Date:
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