• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I am getting error like ResultSet is not clled....plz help

 
Murthy Manchala
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the piece of code and error stack are

while(res.next())
{
PreparedStatement pstmt = con.prepareStatement("select count(*) from TB_USER where USER_ID = ?");
pstmt.setInt(1,res.getInt(1));
ResultSet count = pstmt.executeQuery();
pstmt3.setInt(1,res.getInt(1));
ResultSet date = pstmt3.executeQuery();
if(count.getInt(1)==0) // java:65
{

Errors
-----------
java.sql.SQLException: ResultSet.next was not called
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:517)
at com.Murthy.First.updateOracleTables(First.java:65)
at com.Murthy.First.main(First.java:127) }
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, it sounds like a JDBC question. However, you need to call count.next(), before count.getInt() and date.next() before date.getXxx() method. Since, the cursor is not set to the first record, one needs to call next() method to place the cursor on the first record.

Cheers.

NOTE: Please name your variable carefully, so it wouldn't deceive anyone by its name.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please UseRealWords .
words like "clled" and "p l z" are only meant to confuse others and result in less response for your question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic