Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Logging Pl/SQL run-time errors with source code line numbers ?
Try using DBMS_UTILITY.FORMAT_CALL_STACK. It will provide the line number being processed when the error occurred.
HTH
Peter Brenner
>I checked DBMS_UTILITY.FORMAT_ERROR_STACK before posting my message, but it
>says nothing about source code line numbers (see example n.1).
>What I'm trying to obtain is the same information that I can obtain from
>SQLPlus if a stored procedure gets a run-time error and it doesn't trap it
>with exception handlers (see example n.2).
>
>Thanks for your help anyway and please let me know if you have other hints,
>
>Paolo Ghisotti
>p.ghisotti_at_barilla.it
>
>
>Example n. 1: trying to catch error stack with
>DBMS_UTILITY.FORMAT_ERROR_STACK and error handler
>Source Code:
>create or replace procedure testerrstack as
> Char13 varchar2(13);
>
> begin
> Char13 := '123456789012345';
> exception
> when others then
> dbms_output.put_line(dbms_utility.format_error_stack);
> end testerrstack;
>
>Output:
>SQLWKS> set serveroutput on;
>Server Output ON
>SQLWKS> execute testerrstack;
>Statement processed.
>ORA-06502: PL/SQL: numeric or value error
>
>
>Example N.2 : the same procedure as above but without error handler.
>SqlPlus show the line number where a run-time error occurs
>Source Code:
>create or replace procedure testerrstack as
> Char13 varchar2(13);
> begin
> Char13 := '123456789012345';
> end testerrstack;
>
>Output:
>SQLWKS> set serveroutput on;
>Server Output ON
>SQLWKS> execute testerrstack;
>ORA-06502: PL/SQL: numeric or value error
>ORA-06512: at "DPE.TESTERRSTACK", line 4
>ORA-06512: at line 2
>
>
>
Received on Fri Jan 30 1998 - 00:00:00 CST
![]() |
![]() |