Getting ORA-06502 or ORA-01461 When Calling Stored Procedure That Has a CHAR OUT Parameter From JDBC
(Doc ID 1300792.1)
Last updated on FEBRUARY 24, 2023
Applies to:
JDBC - Version 11.2.0.2.0 and laterInformation in this document applies to any platform.
*** *** ( retested using database and JDBC driver version 12.1.0.2)
Symptoms
A simple JDBC standalone testcase gets ORA-06502 PL/SQL: numeric or value error: character string buffer too small (when database parameter blank_trimming=false) or ORA-01461: can bind a LONG value only for insert into a LONG column (when database parameter blank_trimming=true).
The error is triggered by a CallableStatement executing a PL/SQL stored procedure that has an argument of CHAR(10) defined through a %TYPE which is based on a database table column.
JDBC code excerpt:
Error Stack:
Exception in thread "main" java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "<LOGIN>.P_TEST_PROCEDURE", line 12
ORA-06512: at line 1
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:204)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1007)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3677)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4694)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1086)
at RunTest.callProcedure(RunTest.java:55)
at RunTest.main(RunTest.java:34)
Changes
The issue appears to occur with all versions of the JDBC Driver.
Cause
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
Symptoms |
Changes |
Cause |
Solution |
Solution #1: |
Solution #2: |
Solution #3: ( only works for JDBC/thin) |
References |