How to get the result of a Select count(*) statement with Java ?

June 29, 2009 - 9:29 pm

I want to get the number of rows returned (Select count * from [table] where employeeNo = ?). I just want the integer which will be returned, using java programming. I know how to do resultset etc if it is a regular sql statement but how should I capture just the count result?

Thanks

Try "count(*)" instead of "count *". Then just getInt(1) from your ResultSet.

One Response to “How to get the result of a Select count(*) statement with Java ?”

  1. Bob R Says:

    Try "count(*)" instead of "count *". Then just getInt(1) from your ResultSet.
    References :

Leave a Reply