Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ORA-01013 EXCEPTION WHEN OTHERS - Undokumented Behavior?

FalcoWMay 21 2014 — edited May 28 2014

Hi!

I tried searching everywhere to find some documentation about this, but I couldn't, so I'm asking here:

As far as I can understand the Oracle Documentation EXCEPTION WHEN OTHERS should catch all unhandled Exceptions!!!

But then I stumbled upon ORA-01013 which is User Cancelled... And which just slips right through WHEN OTHERS

DECLARE
  e_cancelled EXCEPTION
;
  PRAGMA EXCEPTION_INIT
(e_cancelled, -1013);
BEGIN
 
BEGIN
    RAISE e_cancelled
;
  EXCEPTION
   
WHEN OTHERS THEN

      -- All Exceptions should be logged here, but starting with Patch 11.2.0.4.0

       -- WHEN OTHERS is NO LONGER TRIGGERED :-o what to do???
      DBMS_OUTPUT
.PUT_LINE('EXCEPTION OTHERS');
 
END;

EXCEPTION
 
WHEN e_cancelled THEN

    -- The Exception has to be handled individually
    DBMS_OUTPUT
.PUT_LINE('EXCEPTION CANCELLED');
END;
/

My research brought me to the Oracle Changelogs, which show with the latest update "ORA-01013 is not catched by WHEN OTHERS anymore"

So this seems to be desired (albeit undocumented???) behaviour... https://support.oracle.com/epmos/faces/DocumentDisplay?id=12838063.8

My Question:

We use detailed error-logging and tracing in our database, catching logging and reraising all errors with "WHEN OTHERS"
is there any Setting or parameter to let the WHEN OTHERS handler catch this exception, or will I have to change hundreds
of packages to insert an additional WHEN ORA-01013 into every method???

Aside from Error-logging, what is with closing of cursors, releasing of ressources ??? Because there is no finally-block in

PL/SQL I usually use BEGIN, EXCEPTION, END like a try-catch block and cleanup after the exception block, but when

a timeout occurs, all that cleanup code will simply be skipped???

Message was edited by: FalcoW Inserted Link to Oracle Changelog for a better understanding when the change occured...

This post has been answered by FalcoW on May 28 2014
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 25 2014
Added on May 21 2014
43 comments
17,923 views