Results 1 to 2 of 2

Thread: Data Retrieval

  1. #1
    Join Date
    Oct 2002

    Question Unanswered: Data Retrieval

    Currently when I issue a conditional select statement to a table it retrieves all the rows satisfying the condition, which is normal. I am intrested in knowing, say if the condition returns 100 rows, i would like to retrieve only 10 records at a time, display and if user wants more and fetch the next 10 and continue till no more retrieval is possible. The normal select goes through till EOF. How do I force the select to stop a point and continue from there for the next batch of fetch. Is there any mechanisam in SQL to do this. Every batch of retrieval should be from the table. This problem has arised because we intend not to maintain the state of the retrieval (either in result set) in server.

    I hope I havn't confused the requirement.

    Last edited by muthuprakash99; 01-02-03 at 03:40.

  2. #2
    Join Date
    Oct 2001
    Hi Prakash,

    I think you can use a procedure and set the counter=0 and increment it one by one through a cursor.

    Also in the procedure you can use the query:
    SELECT rownumber() over() AS rn from TABLENAME;

    This returns the rownumbers in the table which you can increment and fetch in the cursor.

    I hope i haven't confused the requirement either...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts