Re: How to create a function with multiple RefCursor OUT parameters

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "Chuck Bai *EXTERN*" <cbai22(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to create a function with multiple RefCursor OUT parameters
Date: 2008-05-16 13:06:40
Message-ID: b42b73150805160606h65c72cbdq792ed271dcfc6e51@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, May 16, 2008 at 2:17 AM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> wrote:
> Chuck Bai wrote:
> CREATE OR REPLACE FUNCTION test_refcursor(INOUT tcount integer,
> OUT o_user refcursor, OUT o_name refcursor) RETURNS record AS
> $BODY$
> BEGIN
> o_user := 'o_user';
> o_name := 'o_name';
> tcount := tcount + 1;
> OPEN o_user FOR SELECT * FROM user_table;
> OPEN o_name FOR SELECT * FROM name_table;
> END;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE

also don't forget, the refcursors are only valid for the duration of
the transaction.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2008-05-16 13:27:50 Re: Installing debugger
Previous Message Robert Fitzpatrick 2008-05-16 12:32:14 Installing debugger