PAGINATION and REF CURSOR
ZaboApr 8 2009 — edited Apr 8 2009Hello,
When I want to do some pagination,
1/ I need to do a count(*) to know how many rows I have, so that on my php page I can compute the number of pages I have.
select count(*) from (my query).
2/ I write a second query to do the pagination.
SELECT * FROM (SELECT a.*, rownum rn FROM (my query including ORDER BY) a WHERE rownum < p_max ) WHERE rn > p_min
The problem with this solution is that I have to write twice my query and when one is changing I also have to change the second.
Is there a solution based on REF CURSOR for my query and then doing a count and the pagination on the REF CURSOR.
Does anyone know, if it is possible to do something like this ?
Edited by: Zabo on Apr 8, 2009 6:38 AM