Re: returning ref cursor

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Ravi Katkar <Ravi(dot)Katkar(at)infor(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: returning ref cursor
Date: 2010-05-24 13:14:26
Message-ID: AANLkTinE9-E19rNsDk_ZCJLJzX3MY4IKoids1eM8BWWt@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, May 24, 2010 at 1:44 AM, Ravi Katkar <Ravi(dot)Katkar(at)infor(dot)com> wrote:
> Please let me know what’s wrong with below code
> create or replace FUNCTION test_call()
>
> RETURNS VOID
>
>    AS $procedure$
>
>    DECLARE
>
>    c_cursor  REFCURSOR;

give your cursor a name:
c_cursor REFCURSOR default 'a_name';

this name is also how you will use the refcursor from non-plpgsql
fetches later in the transaction if you needed to (in this case you
would likely return the cursor name from the function).

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message ritas 2010-05-24 14:22:19 can't install postgres 8.4 on windows 2003 server
Previous Message venu madhav 2010-05-24 12:53:12 Auto vacuum configuration in postgres.