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 »
Oracle »
PL/SQL »
Exceptions:
- Build-in Exceptions
- ZERO_DIVIDE Exception
- DUP_VAL_ON_INDEX Exception
- INVALID_NUMBER Exception
- OTHERS Exception
Related: