Hi Roland,

You can implent something like this:


   sERROR_TEXT := 'execute P1 failed';
   exec P1;
---
   IF SQLCODE != 0 THEN
      sERROR_CODE := -20005;
      sERROR_TEXT := 'execute P1 failed. Oracle Error Number:: ORA' ||
SQLCODE || '-' || SQLERRM;
      raise DATA_ERROR;
   END IF;
---
--- error handling
---
   EXCEPTION
   WHEN DATA_ERROR THEN
---
      INSERT INTO ERRORS
      ( ERROR_CODE, ERROR_TEXT, ADD_DATE)
      VALUES (sERROR_CODE, sERROR_TEXT,SYSDATE);
---
   WHEN OTHERS THEN
---   Oracle Erros
      sERROR_CODE := 'ORA' || SQLCODE;
      sERROR_TEXT := sERROR_TEXT || ' ' || SQLERRM;
---
      INSERT INTO  ERRORS
      ( ERROR_CODE, ERROR_TEXT, ADD_DATE)
      VALUES (sERROR_CODE, sERROR_TEXT, SYSDATE);
---

HTH

Volker Schoen
E-Mail: mailto:[EMAIL PROTECTED]
http://www.inplan.de



-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Gesendet: Montag, 29. April 2002 16:54
An: Multiple recipients of list ORACLE-L
Betreff: pl/sql


Hallo,

I have a package which includes 5 different procedures. I would like an
exception which tells me an error message if any  of the procedures fail.

So if procedure 1 fails I would get an error message or if procedure number
2 would fail, or proc number 3 e tc then I would get an error message, which
tells me which procedure that fails. I tried this, but didnt work. Just give
me an easy example
on this.   I tried to look it up in the manual but didnt get it work.

Should I put the exception after each  procedureis finished.

Like this: And should  I name the exceptions in different ways, for instance
givethem the names EXCEPTIONS1, EXCEPTIONS2 etc.

p1
exception
p2
exeption
p3
exception
p4
exception
p5
exception

Thanks in advance

Roland






-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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).

Reply via email to