Using SEQUENCE In JDBC
170863Oct 14 2003 — edited Oct 15 2003
I'm using Oracle 8i with JDBC.
I use something like this in my Java application:
pStmt = con.prepareStatement("SELECT MY_ID.NEXTVAL FROM DUAL");
rs = pStmt.executeQuery();
rs.next();
int id = rs.getInt(1);
At this point of fetching the value from the ResultSet, I get this SQL error:
Invalid operation for the current cursor position
The ResultSet is must return one row, so the above code snippet is valid. Then, why do I get this error?
Thanks.