--oracle exception return complete information, see finally attached
--Of course, it's best to select the returned information, along with other relevant information about the code
--such as the occurrence of object name, time, etc. insert pre-built reference error table
--11:08 2007-11-26 edit by Inreyou
Declare
StrName Varchar2 (20);
Begin
StrName: = ' datanotfound '; --datanotfound
If StrName = ' Divideiszero ' Then
RAISE Zero_divide;
elsif strName = ' Datanotfound ' Then
RAISE No_data_found;
End If;
exception
When Zero_divide Then
Dbms_output.put_line (' EXCEPTION in Zero_divide ');
When others then
Dbms_output.put_line (' EXCEPTION in others ');
Dbms_output.put_line (CHR) | | | chr (10) | | ' SQLCODE: ');
Dbms_output.put_line (SQLCODE);
Dbms_output.put_line (CHR) | | | chr (10) | | ' SQLERRM: ');
Dbms_output.put_line (SQLERRM);
Dbms_output.put_line (CHR) | | | chr (10) | |
' Dbms_utility. Format_error_stack (complete error message): ');
Dbms_output.put_line (dbms_utility. Format_error_stack);
Dbms_output.put_line (CHR) | | | chr (10) | |
' Dbms_utility. Format_error_backtrace (Stack information of the exception point when an exception occurs): ');
Dbms_output.put_line (dbms_utility. Format_error_backtrace);
Dbms_output.put_line (CHR) | | | chr (10) | |
' Dbms_utility. Format_call_stack (Stack information of the program's current execution point): ');
Dbms_output.put_line (dbms_utility. Format_call_stack);
End
/*
Report:
EXCEPTION in others
SQLCODE:
100
SQLERRM:
ORA-01403: No data found
Dbms_utility. Format_error_stack (full error message):
ORA-01403: No data found
Dbms_utility. Format_error_backtrace (Stack information for exception points when an exception occurs):
ORA-06512: On line 12
Dbms_utility. Format_call_stack (stack information for the current execution point of the program):
-----pl/sql Call Stack-----
object line Object
handle number name
673aab40 46 anonymous block
*/