File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes How to select a range of rows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to select a range of rows" Watch "How to select a range of rows" New topic
Author

How to select a range of rows

igwe kalu kalu ogba
Ranch Hand

Joined: Feb 03, 2005
Posts: 133
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

Joined: Aug 04, 2004
Posts: 724
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


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to select a range of rows
 
Similar Threads
SQL Question
plz help me with my problem..
sql
regarding the topics posted in javaranch
How to find no of Rows in my ResultSet