Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to select a range of rows

 
igwe kalu kalu ogba
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I want to use my SQL select statement to select a certain number of records within a range. For example, if I use the SQL statement

select * from mychildren.

I would get a resultset containing x amount of rows, say 2000.
Now my problem is that for my program retrieveing 2000 rows from a table is both memory and time consuming. Can I just choose from row 1 to 50. then decide to select from row 51 to 100 and the like. Is this possible in SQL.

If I select incrementally the program can run a lot faster. Thanks and please let me know if this is possible or other possible solutions.
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read about FETCH, it will be database dependent, but here you have link to DB2.
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db2.doc.apsg/bjnqmstr115.htm
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic