Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle pl/sql code line(row) to variable

So is it possible to get current code line?

1,2,3,4 v_variable :=(get_line or something???) and in variable are value 4?
5,6,7,8,9 v_variable :=(get_line or something???) and in variable are value 9?

I just want to find easiest way to catch bugs Thanks.

1,2,3,4, code lines...
like image 922
Strauteka Avatar asked Jul 20 '26 04:07

Strauteka


1 Answers

So is it possible to get current code line?

Yes, it's possible. Starting from Oracle 10g the $$PLSQL_LINE inquiry directive can be used to return number of a line in the code where $$PLSQL_LINE appears:

SQL> declare
  2    l_cur_cl pls_integer;
  3  begin
  4    l_cur_cl := $$PLSQL_LINE;
  5    dbms_output.put_line('Line #: '|| to_char(l_cur_cl) || chr(13)
  6                         || 'Current line #:  '|| to_char($$PLSQL_LINE));
  7  end;
  8  /

Output:

Line #: 4
Current line #:  6
PL/SQL procedure successfully completed
like image 124
Nick Krasnov Avatar answered Jul 22 '26 12:07

Nick Krasnov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!