Received: from ucs.co.za (ucs.co.za [196.23.43.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA69eNs60010 for ; Mon, 6 Nov 2000 04:40:24 -0500 (EST) (envelope-from gaf@ucs.co.za) Received: from ucspost.ucs.co.za (IDENT:root@mailgw1.ucs.co.za [196.23.43.254]) by ucs.co.za (8.9.3/8.9.3) with ESMTP id LAA17641; Mon, 6 Nov 2000 11:50:50 +0200 Received: from jhb.ucs.co.za (jhb.ucs.co.za [172.31.1.73]) by ucspost.ucs.co.za (8.9.3/8.7.3) with ESMTP id LAA30203; Mon, 6 Nov 2000 11:39:34 +0200 Received: from ucs.co.za (IDENT:gaf@pc141.ucs.co.za [172.31.1.141]) by jhb.ucs.co.za (8.9.3/8.8.7) with ESMTP id LAA28786; Mon, 6 Nov 2000 11:44:33 +0200 Message-ID: <3A067C52.82CA7BE8@ucs.co.za> Date: Mon, 06 Nov 2000 11:39:30 +0200 From: Grant Finnemore X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Marc Rohloff CC: pgsql-sql@postgresql.org Subject: Re: Returning Recordsets from Stored-procs References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.postgresql.org id eA69eRs60022 X-Archive-Number: 200011/40 X-Sequence-Number: 71 Marc, Marc Rohloff wrote: > Is there anyway to return a recordset from a Stored Procedure in Postgres so that it can be used as a type of view or select? In short:- No, there isn't. More detail:- PostgreSQL does not have stored procedures as such, it has user defined functions. The difference being that a stored procedure returns both a scalar value (the result), and optionally, one or more sets. (your recordset) Functions on the other hand, only return a scalar value. This has been slightly extended in PostgreSQL so that a list of values can be returned, but these have to be of the same type, and so are not a general replacement for a set. Whilst this is an unfortunate position at the moment, it has been my experience that it does not cause insurmountable problems. (Some short term headaches - yes. ;-) > I know that you can do this in Interbase or MS-SQL. > > I have seen that you can return a complete record but that's not really the same thing. > > Marc Rohloff Regards, Grant -- > Poorly planned software requires a genius to write it > and a hero to use it. Grant Finnemore BSc(Eng) (mailto:gaf@ucs.co.za) Software Engineer Universal Computer Services Tel (+27)(11)712-1366 PO Box 31266 Braamfontein 2017, South Africa Cell (+27)(82)604-5536 20th Floor, 209 Smit St., Braamfontein Fax (+27)(11)339-3421 Johannesburg, South Africa