This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Number of rows in a ResultSet

 
Warren Bell
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you find out how many rows there are in a ResultSet without running through every row and counting them?
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what I've done in the past is to alias the rownum & order it desc in a subquery. that way you get the total number of rows of the query in the very first row.
I'm sure there are better ways - I guess it depends if you prefer to load the rdbms or the application.
Simon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic