ORA-06502 PL/SQL: numeric or value error

ORA-6502 mostly occurs during execution of code in an oracle database due to a bug in the SQL or PL/SQL code. The primary reason this oracle error occurs is when you try to assign a value to a numeric variable but the value is larger than the variable can handle.  ORA-06502 oracle error also occurs if you are trying to assign a non-numeric value to a numeric variable

ORA-06502 :Text: PL/SQL: numeric or value error

Cause: An arithmetic, numeric, string, conversion, or constraint error
occurred.


For example, this error occurs if an attempt is made to assign the
value NULL to a variable declared NOT NULL, or if an attempt is made
to assign an integer larger than 99 to a variable declared NUMBER(2).


Action: Change the data, how it is manipulated, or how it is declared so that
values do not violate constraints.

 

This error is also known to occur when using the weblogic jdriver for oracle to execute an oracle stored procedure through a callable statement. The default length of the string bound to OUTPU is 128 characters and needs to be increased using the CallableStatement.registerOutputParameter() method.