Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get a limited no of records

 
kevin Johnson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
resultSet.next gives me all the rows from the table. Is there any way to limit the no of records say only 10??
Thanx.
kevin

// print out records

while(resultSet.next())
{
//String[] row = new String[columnCount];
for(int i=1; i<columnCount+1; i++) {>
entry = resultSet.getString(i) + ",";
System.out.println(entry);
}

 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setFetchsize
or in Oracle you can have ROWNUM < 11 in the where clause
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic