this is just a demo, never code like this, it is *stupid*
I think computer science courses should devote at least two semesters to "how to actually deal with errors", this is something that is never taught.
I don't know what you mean by referencing that link, that shows a way to capture more information - it doesn't seem to me to be showing a deficiency? But rather a feature...
ops$tkyte%ORA10GR2> create or replace function foobar( p_x in number, p_y in number ) return number
2 as
3 begin
4 return p_x/p_y;
5 exception
6 when others
7 then
8 raise_application_error
9 ( -20001, 'Error in division ' || chr(10) || sqlerrm ||
10 chr(10)|| dbms_utility.FORMAT_ERROR_backtrace );
11 end;
12 /
Function created.
ops$tkyte%ORA10GR2> declare
2 l_answer number;
3 begin
4 l_answer := foobar( 1, 0 );
5 exception when others then
6 dbms_output.put_line( sqlerrm || chr(10) || dbms_utility.FORMAT_ERROR_backtrace);
7 end;
8 /
ORA-20001: Error in division
ORA-01476: divisor is equal to zero
ORA-06512: at "OPS$TKYTE.FOOBAR", line 4
ORA-06512: at "OPS$TKYTE.FOOBAR", line 8
ORA-06512: at line 4
PL/SQL procedure successfully completed.