> String query1 = "Select A from table1"; // A = SQL_CODE
> String query1 = "Select Z, Y from table1 where A = ?"; // note the question
[quoted text clipped - 11 lines]
> psa.executeQuery();
> }
I wouldn't recommend this without using two different connections.
AFAIK, you can only have 1 open resultset per connection. Therefore, the
second executeQuery invalidates the first resultset and it might stop
working or produce incorrect results.
> better still combine the SQL into one statement wih a sub-query
>
> String query1 = "Select Z, Y from table1 where A in (Select A from table1)";
This is the way to go!
Regards,
Heinz
Andy Flowers - 23 Jul 2003 18:27 GMT
<<SNIP>>
> I wouldn't recommend this without using two different connections.
> AFAIK, you can only have 1 open resultset per connection. Therefore, the
> second executeQuery invalidates the first resultset and it might stop
> working or produce incorrect results.
Not true. A Connection has nothing to do with ResultSet, that's the job of
the Statement
A Statement can only have one active result set at any one point in time.
In summary
Connection has 0..many active Statement has 0..1 active ResultSet
<<SNIP