Received: from smtp011.mail.yahoo.com (smtp011.mail.yahoo.com [216.136.173.31]) by postgresql.org (Postfix) with SMTP id 790B347670F for ; Mon, 25 Feb 2002 15:54:43 -0500 (EST) Received: from janwieck (AUTH LOGIN) at psc.progress.com (HELO saturn.janwieck.net) (janwieck@192.233.92.200) by smtp.mail.vip.sc5.yahoo.com with SMTP; 25 Feb 2002 20:54:43 -0000 Received: (from wieck@localhost) by saturn.janwieck.net (8.11.2/8.11.2) id g1PJ9SA01207; Mon, 25 Feb 2002 14:09:28 -0500 From: Jan Wieck Message-Id: <200202251909.g1PJ9SA01207@saturn.janwieck.net> Subject: Re: PLPGSQL func. defn. for returning resultset? In-Reply-To: <3C794AAE.3080405@ivillage.com> from Otis Gospodnetic at "Feb 24, 2002 03:18:54 pm" To: Otis Gospodnetic Date: Mon, 25 Feb 2002 14:09:28 -0500 (EST) Cc: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200202/368 X-Sequence-Number: 6790 Otis Gospodnetic wrote: > Hello, > > I need to write some functions/stored procedures in PLPGSQL. > All examples have a return clause that returns a single item (e.g. > RETURN INTEGER or RETURN VARCHAR, etc.). > > However, I need to return a result set (e.g. SELECT user_id, name FROM > users). What do I specify in the return part of the FUNCTION definition > for that? > CREATE FUNCTION foo() RETURNS ????? AS ' ..... > What do I put in place of ????? > > I could not find any examples for such cases. And it would really surprise me if you could find examples of that. The only way you currently can return a result set would be through a cursor, opened in your function. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com