move cursor without fetching [message #370354] |
Thu, 02 September 1999 10:38 |
Bart
Messages: 3 Registered: September 1999
|
Junior Member |
|
|
Is there a way to advance the cursor position without FETCHing all the intermediate rows?
Here is my situation...
I am writing a C++ program to retrieve data in 10 row blocks (i.e. select rows 1 - 10, then 11 - 20, etc.) However, the select may not always be incremental, for example, I might want to return rows 20 - 30 and then return rows 1 - 10. To return the 20 - 30th rows, I need to fetch the 1 - 19th rows. This is causing needless database and network activity. Any ideas?
Thanks in advance... Bart
|
|
|
Re: move cursor without fetching [message #370355 is a reply to message #370354] |
Thu, 02 September 1999 11:34 |
m a sivan
Messages: 34 Registered: July 1999
|
Member |
|
|
Probably u can make an array and store it.. and then retrieve form an array.. (if the max no of records are not too much) or u can use somekind of dynamic cursor which uses
rownum etc...
See missing numbers is COLUMN (first part will help u )
|
|
|
Re: move cursor without fetching [message #370357 is a reply to message #370355] |
Thu, 02 September 1999 12:12 |
Bart
Messages: 3 Registered: September 1999
|
Junior Member |
|
|
Thanks for the idea. I have investigated the idea of using an array, but I would like to avoid it for a couple of reasons...
1) The query might return thousands and thousands of rows
2) The user will dictate which set of 10 rows they would like to look at (similar to the way a search engine returns results). I would like to avoid the overhead of returning data that will never be looked at.
However, if there is no way move the cursor, I am contemplating using the array approach to store the ROWNUM and then direct accessing the data when the user chooses a given row range...
|
|
|
|
Re: move cursor without fetching [message #370385 is a reply to message #370354] |
Thu, 16 September 1999 11:28 |
abhi
Messages: 16 Registered: September 1999
|
Junior Member |
|
|
if u r retrieving rows based on how they r stored in the daatabase their is no way u can advance..as row num is allotted after the row is fetched. But why is ur network activity increasing? u should run the procedure in the backend and return only the result set to the calling program..
|
|
|