Re: select refcursor into a variable - Mailing list pgsql-general

From Richard Huxton
Subject Re: select refcursor into a variable
Date
Msg-id 200212040946.41082.dev@archonet.com
Whole thread Raw
In response to select refcursor into a variable  ("Madhavi" <madhavi@zoniac.com>)
List 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

pgsql-general by date:

Previous
From: suresh s
Date:
Subject: problem starting postgresql i.e postmaster
Next
From: pginfo
Date:
Subject: Re: pg and number of parameters by insert