INVALID_NUMBER Exception

INVALID_NUMBER exception happens when converting an invalid string into a number.


CREATE TABLE EMP (EMPNO NUMBER(4) NOT NULL,
                  ENAME VARCHAR2(10),
                  JOB VARCHAR2(9),
                  SAL NUMBER(7, 2),
                  DEPTNO NUMBER(2)
);


SQL> BEGIN
  2      INSERT INTO emp(empno, ename) VALUES ('X', 'Greg');
  3  EXCEPTION
  4  WHEN INVALID_NUMBER THEN
  5   DBMS_OUTPUT.PUT_LINE('Conversion of string to number failed');
  6  END;
  7  /
Conversion of string to number failed

PL/SQL procedure successfully completed.

SQL>
Home »
Oracle »
PL/SQL » 

Exceptions:
  1. Build-in Exceptions
  2. ZERO_DIVIDE Exception
  3. DUP_VAL_ON_INDEX Exception
  4. INVALID_NUMBER Exception
  5. OTHERS Exception
Related: