Dear All,
When I executed the below plsql block i got the error. Not sure, 'ORA-06510: PL/SQL: unhandled user-defined exception', why it is coming.
When No data found, I am raising my own exception "userException". I am bit confused. Request all to explain.
DECLARE
userException EXCEPTION;
v_name emp.ename%type;
v_err VARCHAR2(200);
BEGIN
----------------- statement
BEGIN
SELECT ename INTO v_name FROM emp WHERE empno = 1;
EXCEPTION
WHEN no_data_found THEN
v_err := 'No data found for the employee';
raise userException;
WHEN OTHERS THEN
v_err := 'Others Exception';
raise userException;
END;
EXCEPTION
WHEN userException THEN
raise_application_error(-20901, v_err, TRUE);
END;
Error report:
ORA-20901: No data found for the employee
ORA-06512: at line 19
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-01403: no data found