Example plsql exception handlers:
-
EXCEPTION
-
WHEN OTHERS
-
THEN
-
Record_Message('LOG',DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
-
g_sqlerrm := SUBSTR(SQLERRM,1,240);
-
Record_Message('LOG','ERROR - '||g_sqlerrm);
-
Record_Message('LOG','Main Exception Handler msg: ' || g_sqlerrm || ' Sending email');
-
XXGC_EMAIL_FNS_PKG.Email_SST_Message(
-
'The new IVR Overnight Process has failed. This effects element changes. The error message was:' || g_sqlerrm,
-
fnd_global.conc_request_id,
-
'New IVR Overnight Process'
-
);
-
retcode := 2;
Alternative
-
x_output_msg := x_output_msg || 'OtherExcp:=-' || SUBSTR(SQLERRM,1,1024) || '-' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE;
Note: Record_Message code can be foud at https://code.metcarob.com/node/52
Standard Erroring procedure
-
function Msg (
-
P_MSGID IN VARCHAR2,
-
X_ERROR OUT VARCHAR2
-
) return number
-
is
-
l_error varchar2(4096) := '';
-
begin
-
x_error := '';
-
-
//STUFF
-
-
return 0;
-
-
exception when others then
-
l_error := to_char(SQLCODE) || ' ' || nvl(substr(sqlerrm,0,990),'NULL');
-
X_error := l_error || ':-' || nvl(substr(DBMS_UTILITY.FORMAT_ERROR_BACKTRACE,0,3000),'NULL');
-
return 99;
-
end;
Alternate
-
raise_application_error(-20000, 'pHub Transmit msg but target is null!');
Search terms
Stack Trace Dump stacktrace backtrace back
RJM Article Type
Quick Reference