what type of errors can we handle using system define unnamed exception in sqlplus?

Posted by Aspirant on Stack Overflow See other posts from Stack Overflow or by Aspirant
Published on 2012-06-28T15:14:10Z Indexed on 2012/06/28 15:15 UTC
Read the original article Hit count: 220

Filed under:
|
|

I have been trying to access the below code

DECLARE
       N_DEPTNO DEPT.DEPTNO %TYPE :=&DEPT_NUM;
       V_DNAME DEPT.DNAME %TYPE;
       NOT_ENOUGH_VALUES EXCEPTION;
       PRAGMA
             EXCEPTION_INIT(NOT_ENOUGH_VALUES,-06502);
BEGIN
       SELECT DNAME,LOC INTO DNAME FROM DEPT
       WHERE DEPTNO = N_DEPTNO;

       DBMS_OUTPUT.PUT_LINE('Successfully Fetched !!');
EXCEPTION
       WHEN NOT_ENOUGH_VALUES THEN
       DBMS_OUTPUT.PUT_LINE('No Enough Values ... ');
END;

It is still showing error message after specified it in EXCEPTION block.

Can i handle these type of errors using PRAGMA EXCEPTION_INIT i.e not providing enough values in the select statement...

If not what type of errors can be handled in System Defined Unnamed Exception using PRAGMA EXCEPTION_INIT.

© Stack Overflow or respective owner

Related posts about sql

Related posts about Oracle