ORA-06502 PL/SQL: numeric or value error

This error message is very tricky. Here, you can learn how to solve it.

  1. The main cause that produces this message is that you are assigning a value NULL to a variable that does not admit it.
  2. DECLARE
    N1 number(2) NOT NULL :=20;
    N2 number(2);
    BEGIN
    N1 := N2;
    END;

  3. Another possible cause is that you are assigning a number to a variable and its size is to small to hold that value.
  4. DECLARE
    N NUMBER(2);
    BEGIN
    N:= 100;
    END;

  5. Sometimes, you get that error message when you concatenate two strings and the result is assigned to a variable too small.
  6. DECLARE
    C1 varchar2(10) ;
    C2 varchar2(7);
    BEGIN
    C1:=’This is an’;
    C2:=’ error.’
    C1 :=C1||C2 ;
    END;

There are no comments on this post

Leave a Reply