How to locate N'th row in a cursor efficiently ?

From: Matthew <matthew.lai_at_reuters.com>
Date: 1998/06/13
Message-ID: <01bd96bf$1ec1a8d0$8c748bd0_at_dialup>#1/1


Hello,

[Quoted] In our project, I've written a stored procedure that can accept a SQL statement as a string, call the DBMS_SQL package to parse it and fetch the result set.
Since this s.p. will be called by some server side program to produce a web page, it will return rows no. n to m (i.e. a segment of the cursor), in order to give the 'Next' & 'Previous' paging effect. This is because the result set could be more than 10K rows.

Currently, I just repeatedly fetch the records until n, and then return the next m rows.
My question is: It there any more efficient way to do this ? (e.g. any way to SKIP n rows instead of fetch n times...) I have thought of using the WHERE clause to avoid the unwanted rows. However, it can accept any SQL statement, it may contains different WHERE clause and different ORDER BY clause, therefore is very hard to modify the WHERE clause of the SQL statement...

Any idea ???

Thanks & Regards
Matthew Received on Sat Jun 13 1998 - 00:00:00 CEST

Original text of this message