java.sql.SQLException: Exhausted Resultset
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:113)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:147)
出现这个错误的原因是因为ResultSet curser 指针已经在最后一个元素之外了,说明要么是ResultSet 集合为空,要么是集合已经没有可以读取的元素了,此时你再调用rs.get()获取元素,就会报错。
if (rs! = null) {
while (rs.next()) {
count = rs.getInt(1);
}
count = rs.getInt(1); //this will throw Exhausted resultset
}