Using Others Assignment Help

Assignment Help: >> Pre-defined Exceptions - Using Others

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.

1113_Using Others.png

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd