Re: Question on stored functions

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Gunjeet Singh <Gunjeet(dot)Singh(at)eng(dot)sun(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>, <gunjeet(dot)singh(at)sun(dot)com>
Subject: Re: Question on stored functions
Date: 2004-03-09 22:06:30
Message-ID: Pine.LNX.4.33.0403091505470.7159-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 3 Mar 2004, Gunjeet Singh wrote:

>
> Hi,
>
> I could only find support for defining functions in pl/pgsql.
> With a function I can have only one return value. What if I need
> to have multiple OUT parameters (i.e multiple return values) ?
> Is there any support for something that is similar to an Oracle
> stored procedure ?
>
> I understand that I can return a REFCURSOR from a postgres function,
> but my question is for a case, say, where I need to return 2 string
> variables/values based on some logic in addition to a REFCURSOR.
> How do I do that in pl/pgsql ?

You want set returning functions probably:

http://www.postgresql.org/docs/7.4/static/xfunc-sql.html#AEN28798

you can basically return one or more rows of a complex type (i.e. just
like what you get back from a select query).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2004-03-09 22:30:51 Re: autocommit to off?
Previous Message Karl O. Pinc 2004-03-09 19:43:57 Re: 7.4.1 upgrade issues