Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hanlding 'unknown' Exception in PL/SQL

Status
Not open for further replies.

drkestrel

MIS
Sep 25, 2000
439
GB
How could I return the Oracle's System generated Error message that is not explicity Handled by the following clauses
Code:
EXCEPTION
WHEN myError THEN
END;

I could find
Code:
SQLEERMC
in the docs, but that is for ProC, I just would love to have the equivalent for PL/SQL. What is it called? :)
 
when others then [this has to be the last error handler]
<put your code here>



(the error number is sqlerr; the description is sqlerrm -- if my
memory didn't fail me) Jim

oracle, vb
 
If you are going to store the error code and message somewhere, you will need variables to hold them.
In my database, I have a table called ERROR_CENTRAL into which I insert error messages as they arise. In my code I typically have something like:

v_code NUMBER;
v_errm VARCHAR2(2000);
BEGIN
.
.
.
.
EXCEPTION
WHEN OTHERS THEN
v_code := SQLCODE;
v_errm := SQLERRM;
INSERT INTO error_central VALUES(sysdate, v_code, v_errm, 'PROCEDURE my_procedure');
END;

This way, I have a log of any exceptions that occurred, when they occurred, and what object they occurred in.
 
Hey, Is there not a Oracle thingy called
Code:
CATCH_ALL_ERR
. What I meant was the following-
Code:
EXCEPTION
WHEN CATCH_ALL_ERR THEN
--Handle error
END;
did not work!!
but
Code:
EXCEPTION
WHEN OTHERS THEN
--Handle error
END;

What is the difference?? I just need to 'handle'(pass back to caller) those 'unhandled' error message :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top