Re: select refcursor into a variable

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Madhavi" <madhavi(at)zoniac(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: select refcursor into a variable
Date: 2002-12-04 09:46:41
Message-ID: 200212040946.41082.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 04 Dec 2002 6:48 am, Madhavi wrote:
> Hi all,
> I'm executing dynamic queries in postgres7.2.3. Is there a way I can
> execute a refcursor and then select it into a variable and then return that
> variable? My query returns the sum of values. So its only one single
> value...that I want to select into a variable. How do I do this. 'cos I
> don't wnat to return a refcursor.

Not sure that you need a refcursor at all for what you're describing. Define
the function as returning int4 (or whatever numeric type is desired) and
either SELECT INTO, or use a LOOP on the refcursor if that's what you need.

--
Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Al Sutton 2002-12-04 09:47:16 Broadcast replication (Was Re: 7.4 Wishlist)
Previous Message suresh s 2002-12-04 09:43:17 problem starting postgresql i.e postmaster