Many of you would have faced this error while coding in PL/SQL. Below are the details on this error.
ORA-06502:
PL/SQL: numeric or value error string
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 999 to a variable declared NUMBER(3).
The common reasons for this error are:
- You tried to assign a value to a numeric variable, but the value is larger than the variable can handle.
- You tried to assign a non-numeric value to a numeric variable and caused a conversion error.
Action:
Change the data, how it is manipulated, or how it is declared so that values do not violate constraints.
Example :
SQL> CREATE OR REPLACE PROCEDURE ErrorExample
2 AS
3 v_number number(3);
4 BEGIN
5 v_number := 1000;
6 END;
7 /
Procedure created.
SQL> execute ErrorExample();
BEGIN ErrorExample(); END;
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at "ErrorExample", line 5
ORA-06512: at line 1