Declare
N1 Varchar(10);
Begin
Select Ename Into N1 From Scott.Emp Where Empno = 2;
Exception
When Others Then
Dbms_Output.Put_Line('---------------1----------------------');
Dbms_Output.Put_Line(Substr(Sqlerrm, 1, 200));
Dbms_Output.Put_Line('---------------2----------------------');
Dbms_Output.Put_Line(Dbms_Utility.Format_Error_Backtrace);
Dbms_Output.Put_Line('---------------3----------------------');
Dbms_Output.Put_Line(Dbms_Utility.Format_Error_Stack);
Dbms_Output.Put_Line('---------------4----------------------');
Dbms_Output.Put_Line(Dbms_Utility.Format_Call_Stack);
End;