1

i'm trying to find out if there is a way to get the type of exception without explicitly implementing all predefined Exceptions in a when clause.

I wrote a function to send a mail. I call this function in the when others clause of a PL/SQL Procedure, is there a way to pass the type as a varchar or something?
It would be excelling to get the Exception message to pass as an argument too.

regards

2

3 Answers 3

1

As Mat suggested in his comment, one can simply use the variables SQLCODE and SQLERRM to retrieve the Exception. It does not retrieve the type of Exception per se but it definitely provides enough information to solve the Problem. Oracle Documentation

Sign up to request clarification or add additional context in comments.

1 Comment

The link is dead.
0

Search in Oracle Documentation for : DBMS_UTILITY.FORMAT_ERROR_STACK

Comments

0

there are several way , I use SQLERRM

EXCEPTION
  WHEN CANNOTPROCEED THEN


      ORA_ERROR:=SQLERRM;

      ROLLBACK;
insert into LOG_TABLE (LOG_ERROR) Values();
commit;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.