My Oracle Support Banner

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 AUGUST 09, 2023

Applies to:

JDBC - Version and later
Information in this document applies to any platform. *** *** ( retested using database and JDBC driver version


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(
at oracle.jdbc.driver.T4CTTIoer.processError(
at oracle.jdbc.driver.T4C8Oall.processError(
at oracle.jdbc.driver.T4CTTIfun.receive(
at oracle.jdbc.driver.T4CTTIfun.doRPC(
at oracle.jdbc.driver.T4C8Oall.doOALL(
at oracle.jdbc.driver.T4CCallableStatement.doOall8(
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(
at oracle.jdbc.driver.OraclePreparedStatement.execute(
at oracle.jdbc.driver.OracleCallableStatement.execute(
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(
at RunTest.callProcedure(
at RunTest.main(


The issue appears to occur with all versions of the JDBC Driver.



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
 Solution #1:
 Solution #2:
 Solution #3: ( only works for JDBC/thin)

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