Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Reraising an error in a procedure.

Reraising an error in a procedure.

From: Maarten Geurts <mgeurts_at_tip.nl>
Date: 1998/07/12
Message-ID: <35A801D7.215F895F@tip.nl>#1/1

I have a "problem" in handling errors that can be explained as follows:

begin
  savepoint one_record_savepoint;
  ..more code...
  update order_line set qty = qty+ 1 where order_no = parm_ord_no; exception
  then others then

      rollback one_record_savepoint;
      my_check_error(to_char(parm_ord_no),
         sqlcode,sqlerrm,'handle_order_no');
      commit;

end;

The procedure my_check_error logs data errors (like constraints, foreign keys, null colums,trigger_code checks) in a LOG_ERROR table, but has to reraise if there is a serious error (like a dead loack situtation, or table not being accesable) it has to reraise and exit the program to warm the operators to handle the error(well... most of time they are request to first try running the program again and if that does not work to call support).

Normally you could put a "raise;" behind the my_check_error to do this but for this case i would have to change a lot of code. Now its done with a raise_applicaton_error(-20099,parm_sqlerrm). This however results in an -20099 error, and i want to maintain the original error (like -60 for a deadlock). pragma exception init does not handle variables, it needs a litaral numbers.

is there a way to raise variable errors? like raise_application_error(parm_sqlcode,parm_sqlerror);

Have pleasure,

Maarten Geurts. Received on Sun Jul 12 1998 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US