Re: Number of rows in a cursor ? - Mailing list pgsql-sql

From
Subject Re: Number of rows in a cursor ?
Date
Msg-id B74B7433CDDD2C4AA41D94832E32E19D92EE9A@EMEXM1112.dir.svc.accenture.com
Whole thread Raw
In response to Number of rows in a cursor ?  (Bo Lorentsen <bl@netgroup.dk>)
Responses Re: Number of rows in a cursor ?  (Bo Lorentsen <bl@netgroup.dk>)
List pgsql-sql
You cannot count the number of rows in a cursor, unfortunately. I recently ran in to this problem.

As far as I am aware, the only way to count them is to either iterate through them,
or if you are only expecting one or two, perform multiple FETCHES and test if the
record set returned is empty.

http://archives.postgresql.org/pgsql-sql/2005-08/msg00208.php

OPEN cur_overlap FOR EXECUTE 'SELECT *, ....';

FETCH cur_overlap INTO row_one;
FETCH cur_overlap INTO row_two;
       IF (row_two.id IS NULL) THEN ....


King regards,

Neil.



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private
information. If you have received it in error, please notify the sender immediately and delete the original.  Any other
useof the email by you is prohibited. 


pgsql-sql by date:

Previous
From: Szűcs Gábor
Date:
Subject: Re: Tuple insert missing query in ongoing transaction
Next
From: Bo Lorentsen
Date:
Subject: Re: Number of rows in a cursor ?