EXCEPTION
WHEN OTHERS THEN
g_errbuf := SQLERRM;
g_retcode := 2;
write_log('Y',
to_char(SYSDATE, 'HH24:MI:SS') || ' - ' ||
'Data Error happened having Batch ID = ' || p_batch_id ||
' and invoice_ulid = ' || l_process_data_rec_type.invoice_ulid);
write_log('Y',
to_char(SYSDATE, 'HH24:MI:SS') || ' - ' || 'Error ' ||
l_procedure_name || ' : ' || g_errbuf);
IF c_get_ap%ISOPEN
THEN
CLOSE c_get_ap;
END IF;
Asked
Active
Viewed 110 times
-1

William Robertson
- 15,273
- 4
- 38
- 44

LittleBitDeveloper
- 17
- 4
-
1Please put the detailed question in the question itself, not only in the title – Koen Lostrie Jan 07 '22 at 08:35
1 Answers
1
No better place to start the official documentation. If the exception is thrown, SQLERRM
will contain the error message.
Example:
set serveroutput on size 999999
DECLARE
l_num NUMBER;
BEGIN
l_num := 'x';
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line(SQLERRM);
END;
/
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
So in your code, the variable g_errbuf
will contain the error message of the statement that is erroring out.

Koen Lostrie
- 14,938
- 2
- 13
- 19