select refcursor into a variable

Started by Madhavi Daroorover 23 years ago4 messagesgeneral
Jump to latest
#1Madhavi Daroor
madhavi@zoniac.com

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.

Thanx
Madhavi

#2suresh s
sureshatwork@yahoo.com
In reply to: Madhavi Daroor (#1)
problem starting postgresql i.e postmaster

hi,

/etc/rc.d/init.d/postgresql start

when i run this it says user 'postgres' does not
exists,
i am unable to run the postgres,

to create a postgres user i should first start
postgresql

createuser says no postmaster runnning

how can this problem be solved

suresh s

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

#3Richard Huxton
dev@archonet.com
In reply to: Madhavi Daroor (#1)
Re: select refcursor into a variable

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

#4Thomas Beutin
tyrone@laokoon.IN-Berlin.DE
In reply to: suresh s (#2)
Re: problem starting postgresql i.e postmaster

Hi,

On Wed, Dec 04, 2002 at 01:43:17AM -0800, suresh s wrote:

/etc/rc.d/init.d/postgresql start

when i run this it says user 'postgres' does not
exists,
i am unable to run the postgres,

to create a postgres user i should first start
postgresql

createuser says no postmaster runnning

This is the >postgres user creating tool<, but You must use
the >system user creating tool< to create the user for
the database (defaults to "postgres"). This user should own
the postgres insatllation directory or must have at least
write permission in this area.

So long,
-tb
--
Thomas Beutin tb@laokoon.IN-Berlin.DE
Beam me up, Scotty. There is no intelligent live down in Redmond.