Обсуждение: select refcursor into a variable

Поиск
Список
Период
Сортировка

select refcursor into a variable

От
"Madhavi"
Дата:
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



problem starting postgresql i.e postmaster

От
suresh s
Дата:
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

Re: select refcursor into a variable

От
Richard Huxton
Дата:
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

Re: problem starting postgresql i.e postmaster

От
Thomas Beutin
Дата:
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.