I'm testing few procedures which are in production and have added some part in an exception block. I made a copy of those procedure in a test enviorment and I need to raise a exception for testing.
What is a simple way or with a minimum code change, to make procedure enter an exception block?
We just have others
in the exception block where we are catching all exceptions. For example:
DECLARE
-- something
BEGIN
-- I need some operation to do here which will make control go to exception
EXCEPTION
WHEN others THEN
-- handling error (Need to check these changes)
END;
I have created a procedure to test the control flow in case of exception but its giving me error. Code is below
CREATE OR REPLACE Procedure Exception_Check
AS
BEGIN
dbms_output.put_line('step 1..........');
raise_application_error(-20111, 'Step 2...........');
dbms_output.put_line('step 3..........');
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('step 4, In to the exception block..........');
raise_application_error(-20112, 'Step 5........... In raising application error');
END;
What I m doing wrong?