Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I have a loop where by using statement.executeQuery() a query is executed 2 times.For first time query is executed successfully but second time it returns empty resultSet.If I run the query at backend(Oracle 11g) it returns correct result but not when executed from Java Application.the query is a simple SELECT statement.Please help
Java
int size=0;
for(int i=0;i<2;i++){
    rs=stmt.executeQuery("SELECT Column1,Column2 FROM Table1,Table2 WHERE Table1.Column = Table2.Column");
   while(rs.next()){
      size++;
      String strValue = rs.getString(1);
   }
}

[Edit]Code block added[/Edit]
Posted
Updated 23-Apr-13 7:34am
v4
Comments
[no name] 23-Apr-13 13:15pm    
I do not see a loop, executeQuery, resultSet or any SELECT statement anywhere in your posting.
ZurdoDev 23-Apr-13 13:20pm    
Please post the relevant code.

1 solution

You have used loop twice and none of any output from resultset has been fetched.Your first resultset will be flush by second loop iteration.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900