My Oracle Support Banner

12c PreparedStatement Parses SQL Incorrectly Causing java.lang.ArrayIndexOutOfBoundsException (Doc ID 2102983.1)

Last updated on NOVEMBER 09, 2021

Applies to:

JDBC - Version to [Release 12.1]
Information in this document applies to any platform.


When moving from the Oracle 11g R2 client to the 12c client in an application using JDBC OCI for connection, it is noticed that 2 queries are now parsed incorrectly. In one case, after preparing the statement, the metadata is fetched. The number of parameters reported is 1 and should be 2. Altering the whitespace slightly in the SQL will allow the query to parse correctly and report the correct number of parameters, which is 2.

In another case, after preparing the statement, the metadata is fetched. Fetching the metadata results in a java.lang.ArrayIndexOutOfBoundsException.

java.lang.ArrayIndexOutOfBoundsException: 128
at oracle.jdbc.driver.OracleParameterMetaDataParser.computeBasicInfo(
at oracle.jdbc.driver.OracleParameterMetaDataParser.getParameterMetaDataSql(
at oracle.jdbc.driver.OracleParameterMetaData.getParameterMetaData(
at oracle.jdbc.driver.OraclePreparedStatement.getParameterMetaData(
at oracle.jdbc.driver.OraclePreparedStatementWrapper.getParameterMetaData(

Again, altering the SQL by moving a condition which contains an IN clause to after the parameters in the SQL allows the SQL to parse cleanly and the metadata to report the correct number of parameters, which is 3.

Both of these queries were parsed correctly with the 11g R2 client.





To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.