• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to select a range of rows

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic