ORA-06502: PL/SQL: numeric or value error: character to number conversion error

ORA-06502: PL/SQL: numeric or value error: character to number conversion error

Oracle PL/SQL error message: ORA-06502: PL/SQL: numeric or value error: character to number conversion error.

Cause:

You tried to do a numeric or string conversion or constraint error occurred.

Solution:

Change the data type with the same data type you declared.

Example:

declare
  v_id number;
begin
  v_id := 'abc';
  DBMS_OUTPUT.PUT_LINE('v_id: '||v_id);
end;

Output:

ORA-06502: PL/SQL: numeric or value error: character to number conversion error

ORA-06512: at line 4




Correct:

declare
  v_id number;
begin
  v_id := 123;
  DBMS_OUTPUT.PUT_LINE('v_id: '||v_id);
end;

Output:

v_id: 123