I would appreciate the help with the following:
I am getting JDBCException when setting parameters onto JDBC prepared statement.
The fragment of the query where the error is looks like this
... AND (tbl1.field1, tbl2.field2) IN ((?, ?), (?, ?)) ...
And my list of parameters is a an ArrayList of values
{123, 235689, 25,2568982}
If I run the query in the SQLDeveloper, substituting values for '?' - I get the right result But, when running in the Java program it throws the JDBCException
An JDBC exception occurred. Statement: SELECT ... FROM .. WHERE ..AND (tbl1.field1,
tbl2.field2) IN ((?, ?), (?, ?)) .. Invalid column index
The debugger brings me to the line that does this:
statement.setLong(i, lp.longValue());
where 'statement' is a PreparedStatement ..
statement.setLong(i, lp.longValue())in a loop, withibeing an int starting at0? Bind variables are indexed from 1, not 0.