#1
  1. No Profile Picture
    Mentat of IX
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Bucuresti / Toronto
    Posts
    112
    Rep Power
    12

    Getting the number of rows in a table


    I am looking to get the number of rows in a table however I can't seem to find any methods through the ResultSet and ResultSetMetaData classes .

    Does anybody here know how to do get that info ?

    thanks
    FreeBSD , dooing more with less since 10 years ago
  2. #2
  3. No Profile Picture
    Clueless llama
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2001
    Location
    Lincoln, NE. USA
    Posts
    2,353
    Rep Power
    117
    As far as I know the only way to get the number of records in a resultset is to read through the whole resultset and count (put the info in a collection so you can read through it again if need be) or make a seperate query (or as a returned field if you want)using the COUNT(*) database function.
  4. #3
  5. No Profile Picture
    Mentat of IX
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Bucuresti / Toronto
    Posts
    112
    Rep Power
    12
    thanx , yea count works fine enough ( i was expecting it to be slower )
  6. #4
  7. No Profile Picture
    Mentat of IX
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Bucuresti / Toronto
    Posts
    112
    Rep Power
    12
    hmm i think i found an even faster way of dooing this . Since i like keeping sequences tied up to my row numbers i simply do
    select currval('sequence_of_hugetable') and get the last row's nr

IMN logo majestic logo threadwatch logo seochat tools logo