Tuesday, June 24, 2014

java.sql.SQLException: ORA-01008: not all variables bound



One of the causes of this error can be found in the following snippet of code:

Cause:
query = "select * from AAA where condn = ?";
pstmt = con.prepareStatement(query);
pstmt.setString(1, firstValue);
// ResultSet rs = pstmt.executeQuery(query); // Wrong Usage - Do not provide query again
ResultSet rs = pstmt.executeQuery(); // Correct Usage

Another reason is that you have not mapped all '?' with corresponding values

No comments:

Post a Comment