ORA-06502: PL/SQL: numeric or value error: character string buffer too small

Problem:

Example:

Declare
v_variable1 varchar(5);
BEGIN
select '123456' into v_variable1  from dual;
END;
/

Declare

*

ERROR at line 1:

ORA-06502: PL/SQL: numeric or value error: character string buffer too small

ORA-06512: at line 4

Cause: Variable length into clause v_variable1 is 5 character where output that trying to store in that variable is more than 5 character which cause the error.

 

Solution:

Increase the length of the variable v_variable1.

Example:

Declare
v_variable1 varchar(6);
BEGIN
select '123456' into v_variable1  from dual;
END;
/

PL/SQL procedure successfully completed.

 

Comments