I've moved...

This blog now has a new home - please update your shortcuts and readers to: www.jeffkemponoracle.com. Sorry for any inconvenience!

Monday, August 04, 2008

"This Procedure Never Raises Exceptions"

It's a really bad thing to do, but that's ok because "we put comments in that say it's bad".

[Full Article]

2 comments:

  1. If you would, please give a code example of what you mean by 'this can be handled with a ROLLBACK in the EXCEPTION handler'.
    thx

    ReplyDelete
  2. Hi usertale,

    To ensure we don't get ORA-06519, we just need to ensure that all possible exit points, including exception handlers, end in a COMMIT or a ROLLBACK, e.g.:

    PROCEDURE insert_stats IS
    PRAGMA AUTONOMOUS_TRANSACTION
    BEGIN
    INSERT INTO stats_table ...
    COMMIT;
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    RAISE;
    END insert_stats;

    By the way, I've added the "RAISE" so that the calling process knows that something's gone wrong - because you normally would not handle "OTHERS" without re-raising the exception.

    ReplyDelete

Note: only a member of this blog may post a comment.