how to find number of records in ResultSet

dku.rajkumar :

I am getting ResultSet after an Oracle query. when I iterating through the ResultSet its going in infinite loop.

ResultSet rs = (ResultSet) // getting from statement
while (rs.next()) {
//
//
}

this loop is not terminating so I tried finding number of records using rs.getFetchSize() and its returning a value 10. I want to know if this is the correct method to find out number of records in ResultSet and if the count is 10 why is it going in infinite loop. Please give your opinion.

Erich Kitzmueller :

Actually, the ResultSet doesn't have a clue about the real number of rows it will return. In fact, using a hierachical query or a pipelined function, the number might as well be infinite. 10 is the suggested number of rows that the resultset should/will try to fetch in a single operation. (see comment below).

It's best to check your query, if it returns more rows than you expect.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to find Number of records inserted into sql table

How to find the maximum number of associated records?

Find number of records in an array of structures

How to get the number of columns from a JDBC ResultSet?

How get the number of rows count by ResultSet in Java

How to get a set number of rows from a ResultSet

how to make a column for auto serial number to find number of records in jquery datatable

How to find if records match or not

How to find out if a Java ResultSet obtained is empty?

How to find whether a ResultSet is empty or not in Java?

How to Order only first 20 records in a resultset using SQL?

find the number of skip rows between records

How to find number of records in a csv file placed in google cloud storage without downloading the file

How to calculate space for number of records

How to validate the number of children records?

How to limit number of records in TFDMemTable?

How to count the number of created records?

how to restrict number of records to create

SQLite how to limit the number of records

How to find duplicate records in PostgreSQL

How to find records in nested documents?

CakePHP: How to write a find() query that excludes one field in the resultset?

How to continue filtering beyond BeautifulSoup find_all ResultSet?

How To Find Number Of Extentions

How to Find Prime Number

How to find the nth number?

How I count all the number of records in a RecordStore

how to return number of records as a part of a select statement?

How to determine the AVERAGE number of associated records