PreparedStatement fails with "Not all return parameters registered" when "returning" in column name of DML statement (Doc ID 1091003.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version 11.1.0.7 and later
Information in this document applies to any platform.

Symptoms

When using JDBC 11.1.0.7 a PreparedStatement fails with "java.sql.SQLException: Not all return parameters registered" when executing a DML statement that has "returning" in a column name. "Not all return parameters registered" is the text for ORA-17173.

An example of code that fails with "Not all return parameters registered" is:
pstmt = conn.prepareStatement("update t1 set xreturningy = ?");
pstmt.setInt(1, 5);
pstmt.executeUpdate();

The exception and java stack trace are:
java.sql.SQLException: Not all return parameters registered
     at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
     at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:197)
     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:269)
     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:490)
     at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2910)
     at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:2202)
     at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3382)
     at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3468)
     at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1062)
     at Bug6730535.main(Bug6730535.java:39)

This problem does not occur in JDBC 11.1.0.6 or JDBC 11.2.0.1.

Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms