Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Record Count

 
Sam Furtado
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys !!!
Is there a way to find out the number of records returned by a select query without having to make another query (something like select count(*)) that returns the number of records. I mean something similar as in the case of ASP's rs.recordCount() functionality.
Pls let me know.
Thanks Guys
 
Snigdha Solanki
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortuantely, there is no such method available in Java API. Either you use count(*) to get the row count or if you want to know the no of records after query is executed, keep a counter variable and increment it before your while loop ends for each record.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!