pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Grant Finnemore <gaf@ucs.co.za>
To: Marc Rohloff <Marc.Rohloff@eskom.co.za>
Cc: pgsql-sql@postgresql.org
Subject: Re: Returning Recordsets from Stored-procs
Date: Mon, 06 Nov 2000 11:39:30 +0200
Message-ID: <3A067C52.82CA7BE8@ucs.co.za> (raw)
References: <sa0684b9.087@eskom.co.za>

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





view thread (4+ messages)  latest in thread

Message-ID: <3A067C52.82CA7BE8@ucs.co.za>
Permalink:  ../3A067C52.82CA7BE8@ucs.co.za/
Also on:    postgresql.org/message-id/3A067C52.82CA7BE8@ucs.co.za

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gaf@ucs.co.za, Marc.Rohloff@eskom.co.za
  Subject: Re: Returning Recordsets from Stored-procs
  In-Reply-To: <3A067C52.82CA7BE8@ucs.co.za>
  References: <sa0684b9.087@eskom.co.za> <3A067C52.82CA7BE8@ucs.co.za>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox