Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ReturnSet

Status
Not open for further replies.

scohan

Programmer
Dec 29, 2000
283
US
I'm trying to place a while loop within a while loop where both are calling the next method of a ResultSet, however, it's not working. I can call each loop separately and they work, but when I try to embed one inside the other, I get

at oracle.jdbc.dbaccess.DBError.check_error(Compiled Code)
at oracle.jdbc.driver.OracleResultSet.next(Compiled Code)

Am I trying to do something that can't be done? Thanks.
 
hello

perhaps are you trying to access more rows than available in the ResultSet...

generally the 'next()' method returns a boolean to inform is there are more rows to read (return true) or no more (return false).

if you don't check this boolean, you get an exception when you have no more rows !

a while in a while make N*N calls to 'next()'

and two consecutives while make 2*N calls...

perhaps it's the reason, the second way works fine :)

manu0
 
Thanks. I'm going to try to read the second query into an array and use the array within the first while. Since the second call is a short, static list of data, I should be putting it in an array anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top