Using Others:
To handle any type of an exception, use OTHERS. This is a handler which handles any exception. The example for handling exception is as follows:
Example
DECLARE
MYSAL NUMBER;
MYENAME VARCHAR2 (20);
BEGIN
SELECT SAL INTO MYSAL FROM EMP WHERE DEPTNO=10; #for selecting salary field from employee table where department No =10#
DBMS_OUTPUT.PUT_LINE (MYSAL);
SELECT ENAME INTO MYENAME FROM EMP WHERE EMPNO=&X;
DBMS_OUTPUT.PUT_LINE ('THE NAME OF THE EMPLOYEE IS '||MYENAME);
EXCEPTION
WHEN TOO_MANY_ROWS THEN
DBMS_OUTPUT.PUT_LINE('Use Cursors'); WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('OTHERS EXCEPTION HANDLED');
END;
Note: In the Exception Section always OTHERS must be the last handler.