aspose file tools*
The moose likes JDBC and the fly likes Row count in oracle..? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Row count in oracle..?" Watch "Row count in oracle..?" New topic
Author

Row count in oracle..?

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Hi Friends

Is is possible to get the number of rows from oracle table with out using ResultSet rst .next() method .


Creativity is nothing but Breaking Rules
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

No. But that is because you can't do anything with any ResultSet without first moving the cursor to a row. However, you can use a query to find out how many rows a query will return without having to iterate through the whole query ResultSet by using the count SQL function.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
Hi,

You can use select count(*) as my_count from table_name to get the number of row count from a table.

rs.getInt("my_count") will return you number of rows..




Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Thanks all of us.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Row count in oracle..?