Re: number of rows in a cursor

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christoffer Gurell <orbit(at)0x63(dot)nu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: number of rows in a cursor
Date: 2004-02-10 12:37:48
Message-ID: 200402101237.i1ACbmX27643@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christoffer Gurell wrote:
> After declaring a cursor. Is there any way you can check the number of rows
> that cursor contains ??

test=> BEGIN;
BEGIN
test=> DECLARE xxx CURSOR FOR SELECT * FROM pg_class;
DECLARE CURSOR
test=> MOVE ALL IN xxx;
MOVE 184

Yes, you can MOVE ALL in the cursor and look at the return status, in
this case 184 rows.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mike 2004-02-10 12:41:31 Confused newbie (to PG not DB's)
Previous Message Bruce Momjian 2004-02-10 12:23:57 Re: fsync = true beneficial on ext3?