Mark I don't believe that exceptions raised in an exception block can be caught by when clauses in that same block. You could do it with a nested block like this though: -
BEGIN BEGIN <some code here - hopefully!> EXCEPTION WHEN exc_case1 THEN <something specific> RAISE exc_common; WHEN exc_case2 THEN <something different> RAISE exc_common; END; EXCEPTION WHEN exc_common THEN <common exception code> WHEN OTHERS THEN <panic a little bit> END; Regards David Lord > -----Original Message----- > From: Mark Richard [mailto:[EMAIL PROTECTED] > Sent: 25 March 2003 03:29 > To: Multiple recipients of list ORACLE-L > Subject: Best Practise for exception handling in PL/SQL > > > Hi All, > > I was curious to hear people's opinions on the following issue: > > In a PL/SQL procedure I have multiple exception handlers which share a > considerable amount of code. For example, they all typically > display a > message to the screen, shutdown a few open files, perform a > rollback and > raise the exception. They all vary, however, at the begining. > > Is it preferable (or even allowed) to combine the common > exception handling > into a single exception? I imagine it's preferred if only > for the reason > of improving readability and reducing the chances of slightly > messing one > up. What is the best way to share exception code? > > Regards, > Mark. > > PS: Is the below code even valid or is another approach required? > > BEGIN > <some code here - hopefully!> > EXCEPTION > WHEN exc_case1 THEN > <something specific> > RAISE exc_common; > > WHEN exc_case2 THEN > <something different> > RAISE exc_common; > > WHEN exc_common THEN > <common exception code> > > WHEN OTHERS THEN > <panic a little bit> > END; > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>>>> > Privileged/Confidential information may be contained in > this message. > If you are not the addressee indicated in this message > (or responsible for delivery of the message to such person), > you may not copy or deliver this message to anyone. > In such case, you should destroy this message and kindly > notify the sender > by reply e-mail or by telephone on (61 3) 9612-6999. > Please advise immediately if you or your employer does not > consent to > Internet e-mail for messages of this kind. > Opinions, conclusions and other information in this message > that do not relate to the official business of > Transurban City Link Ltd > shall be understood as neither given nor endorsed by it. > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>> > >>>>>>>>>>>>>>>>>> > > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.net > -- > Author: Mark Richard > INET: [EMAIL PROTECTED] > > Fat City Network Services -- 858-538-5051 http://www.fatcity.com > San Diego, California -- Mailing list and web hosting services > --------------------------------------------------------------------- > To REMOVE yourself from this mailing list, send an E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). > ********************************************************************** This message (including any attachments) is confidential and may be legally privileged. If you are not the intended recipient, you should not disclose, copy or use any part of it - please delete all copies immediately and notify the Hays Group Email Helpdesk at [EMAIL PROTECTED] Any information, statements or opinions contained in this message (including any attachments) are given by the author. They are not given on behalf of Hays unless subsequently confirmed by an individual other than the author who is duly authorised to represent Hays. A member of the Hays plc group of companies. Hays plc is registered in England and Wales number 2150950. Registered Office Hays House Millmead Guildford Surrey GU2 4HJ. ********************************************************************** -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Lord, David - CSG INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).