Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No. of rows in a table

 
Rani Mukherjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
How to get the no. of rows the table having in it? I am using oracle as database & JDBC-ODBC Bridge.
Thanx in advance
Rani
 
Rani Mukherjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Java masters in Europe & America not yet come out from their weekends. Anyhow I will have to wait for them for their reply.
Rani
 
Ambrose Tati
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need the following sql statement:
select count(*) from <table name>;
Hope to have been of any help
Ambrose
[This message has been edited by Thomas Paul (edited January 29, 2001).]
 
Rani Mukherjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ambrose. I will try out this.
Rani
 
Rani Mukherjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ambrse,
I am sorry it is not working.
Rani
 
Shripad Bokil
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try this....
String query="select count(*) from tablename";
ReaultSet ra=st.executeQuery(query);
while(rs.next()){
String count=rs.getString(1);
}
Hope this should work out for you,
Shripad
 
Anjali Ajwani
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rani,
Try this:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(<url>,<sid>,<password>);
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery(<query>);
while(rs.next())
{
int ctr = ctr + 1;
}
Anjali
Originally posted by Rani Mukherjee:
Hello,
How to get the no. of rows the table having in it? I am using oracle as database & JDBC-ODBC Bridge.
Thanx in advance
Rani

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic