Ora 06502

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

Cause: An error occurred relating to arithmetic, numeric, string, conversion operations. When an attempt is made to assign an integer larger than 999 to a variable declared NUMBER(3) for example, or for a variable declared NOT NULL if an a user tries to assign the value NULL.

Action: Modify the data, how it is declared, or the operations on it to eliminate violations.

Description: Many data type and definition problems generate this message, with multiple instances shown. Example one illustrates a constraint violation when setting a "Not Null" variable to null. The second case shows the error when assigning a value larger than the variable definition.

    Case 1: declare
    w_string varchar2(3) not null :='NOT NULL FIELD';
    begin
    w_string := '';
    end;
    /
    ÖÖÖÖ
    declare
    *
    ERROR at line 1: ORA-06502: PL/SQL: numeric or value error:
    character string buffer too small
    ORA-06512: at line 2


    Case 2: declare
    w_number number(3);
    begin
    w_number := 9999;
    end;
    /
    ÖÖ...
    declare
    *
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 4


 

Problems with your database performance? Monitor database reponse time. Free trial. Results in 30 minutes.
Learn More
Oracle SQL Server DB2 Sybase