Re: How do i return a dataset from a stored procedure

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Roberto Mello <rmello(at)cc(dot)usu(dot)edu>
Cc: teknokrat <teknokrat(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: How do i return a dataset from a stored procedure
Date: 2002-07-06 02:17:16
Message-ID: 200207060217.g662HGT11627@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Roberto Mello wrote:
> On Fri, Jul 05, 2002 at 01:32:33AM -0700, teknokrat wrote:
> > I can't figure out how to return a group of rows from a function
> > written in plpgsql (or plsql for that matter). The only way i have
> > seen it done is with a setof table return value in sql. But since the
> > query was a single select anyway i don't see the point of this. Is
> > there a way of creating a temporary table in a procedure and using it
> > as the output?
>
> Search the list archives (through groups.google.com - it's
> comp.databases.postgresql) or see the developer docs for PL/pgSQL. You
> can achive that effect by returning a cursor in PG 7.2 (the section on
> returning cursors is ommitted from the current docs in
> www.postgresql.org/idocs, so you need to look at the developer docs - see
> www.us.postgresql.org).

7.3 will have better docs on using it but you can see them now in the
developers docs:

http://developer.postgresql.org/docs/postgres/plpgsql-cursors.html

See the bottom of that page for examples.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-07-06 04:35:06 Re: Is Dropping a column "CHECK" constraint possible?
Previous Message Bruce Momjian 2002-07-05 18:52:23 Re: Possible Bug regarding temp tables (sql or psql?)