On Tue, Oct 19, 2010 at 1:18 AM, AI Rumman <rumman...@gmail.com> wrote:

> Not actualy. I used pagination with limit clause in details query and I
> need the total number of records in the detail query.
>
>
Can you use a cursor?  Roughly...

BEGIN;
DECLARE x CURSOR FOR SELECT * FROM crm;
MOVE FORWARD ALL IN x;
MOVE BACKWARD ALL IN x;
MOVE FORWARD 100 IN x;
FETCH FORWARD 100 FROM x;
CLOSE x;
COMMIT;

Your  application would need to get the actual text result from the "MOVE
FORWARD ALL IN x;" statement to know the total number of records from your
SELECT.  After that, do your pagination via the "MOVE FORWARD 100 IN x;" and
"FETCH FORWARD 100 FROM x;" statements.

HTH.
Greg

Reply via email to