DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Handling unnamed oracle exception

  1. #1
    Join Date
    Sep 2001
    Posts
    44

    Angry

    Hi,
    I was just reading through the oracle doc on "Handling PL/DQL errors". The doc says to handle unnamed oracle exception use the OTHERS handler or the pragma EXCEPTION_INIT...but i fail to understand why Oracle would have unnamed EXCEPTION in the first place.. why not give some name for those exceptions..

  2. #2
    Join Date
    Apr 2002
    Posts
    11

    Most Oracle errors are unnamed

    There are hundreds (thousands?) of Oracle error codes, and only a dozen or two have predefined names in PL/SQL. You can use EXCEPTION_INIT to associate a name of your choosing with an Oracle error code (I often use SNAPSHOT_TOO_OLD for -1555), if you want to handle a specific error.

    Otherwise, an "WHEN OTHERS THEN ..." statement in an EXCEPTION block will handle anything not specifically handled already. I often use it to return NULL from a function when something unanticipated happens [like the DBA taking the database down :-) ].

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width