Click here to Skip to main content
13,090,730 members (44,146 online)
Rate this:
Please Sign up or sign in to vote.
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
int size=0;
for(int i=0;i<2;i++){
    rs=stmt.executeQuery("SELECT Column1,Column2 FROM Table1,Table2 WHERE Table1.Column = Table2.Column");
      String strValue = rs.getString(1);

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

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 23 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100