• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

No. of rows in a table

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ambrose. I will try out this.
Rani
 
Rani Mukherjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ambrse,
I am sorry it is not working.
Rani
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
I child proofed my house but they still get in. Distract them with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic