When displaying line numbers in a worksheet, I would often like to see not only the global line number within the entire worksheet, but also the local line number for each individual statement, in case there are multiple statements. For example:
SET SERVEROUTPUT ON
BEGIN
dbms_output.put_line('abc');
END;
/
BEGIN
raise_application_error(-20000, 'TEST');
END;
/
When I run the above I get the following result (in German):
abc
PL/SQL-Prozedur erfolgreich abgeschlossen.
Fehler beim Start in Zeile: 8 in Befehl -
BEGIN
raise_application_error(-20000, 'TEST');
END;
Fehlerbericht -
ORA-20000: TEST
ORA-06512: in Zeile 2
20000. 00000 - "%s"
*Cause: The stored procedure 'raise_application_error'
was called which causes this error to be generated.
*Action: Correct the problem as described in the error message or contact
the application administrator or DBA for more information.
What bothers me is "ORA-06512: in Zeile 2", which talks about line number 2 in the local block, but that's really line number 9 in the worksheet. The workaround is to delete everything prior to that specific block and then see where line number 2 is, but that isn't really practical. It would be nice if both line numbers would be displayed next to each other, as in:
/* 01 01 */ SET SERVEROUTPUT ON
/* 02 00 */
/* 03 01 */ BEGIN
/* 04 02 */ dbms_output.put_line('abc');
/* 05 03 */ END;
/* 06 04 */ /
/* 07 00 */
/* 08 01 */ BEGIN
/* 09 02 */ raise_application_error(-20000, 'TEST');
/* 10 03 */ END;
/* 11 04 */ /