It's given in the exception?
SQL> create or replace procedure p as
2 begin
3 null;
4 raise no_data_found;
5 end;
6 /
Procedure created.
SQL>
SQL> exec p;
BEGIN p; END;
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "CHRIS.P", line 4
ORA-06512: at line 1
Of course, if you've been trapping and re-raising the exceptions you'll lose the original line number:
SQL> create or replace procedure p as
2 begin
3 null;
4 raise no_data_found;
5 exception
6 when no_data_found then
7 raise;
8 end;
9 /
Procedure created.
SQL>
SQL> exec p;
BEGIN p; END;
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "CHRIS.P", line 7
ORA-06512: at line 1
In 12c you can use utl_call_stack to get information about where it was actually raised:
SQL> create or replace procedure p as
2 begin
3 null;
4 raise no_data_found;
5 exception
6 when no_data_found then
7 dbms_output.put_line(
8 utl_call_stack.backtrace_unit ( utl_call_stack.error_depth ) || ' line ' ||
9 utl_call_stack.backtrace_line ( utl_call_stack.error_depth )
10 );
11 raise;
12 end;
13 /
Procedure created.
SQL>
SQL> exec p;
CHRIS.P line 4
BEGIN p; END;
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "CHRIS.P", line 11
ORA-06512: at line 1
For further reading, see:
http://www.oracle.com/technetwork/issue-archive/2014/14-jan/o14plsql-2045346.html