....
One nice thing about v$sql, is that there is the PROGRAM_xxx columns, which indicate the object_id and line number of the plsql program from which a sql command was initiated
.....
could you help me to understand, which column from v$session indicate the line no of the plsql unit?
demo@ORA11G> create or replace procedure p
2 as
3 begin
4 for x in (select b1.object_name , b2.username
5 from all_objects b1 ,
6 all_users b2)
7 loop
8 NULL ;
9 end loop;
10 end;
11 /
Procedure created.
demo@ORA11G> select userenv('sid') from dual;
USERENV('SID')
--------------
11
demo@ORA11G>
demo@ORA11G> exec p ;
PL/SQL procedure successfully completed.
While the above was running from sql*plus, able to see these details from the other session.
demo@ORA11G> column sql_fulltext format a20
demo@ORA11G> column prev_sql_fulltext format a20
demo@ORA11G> column plsql_entry_object_id format 99999 heading c1
demo@ORA11G> column plsql_entry_subprogram_id format 99999 heading c2
demo@ORA11G> column plsql_object_id format 99999 heading c3
demo@ORA11G> column plsql_subprogram_id format 99999 heading c4
demo@ORA11G> select t1.sql_id,
2 ( select t2.sql_fulltext
3 from v$sql t2
4 where t1.sql_id = t2.sql_id and
5 t1.sql_child_number = t2.child_number ) sql_fulltext,
6 ( select t2.sql_fulltext
7 from v$sql t2
8 where t1.prev_sql_id = t2.sql_id and
9 t1.prev_child_number = t2.child_number ) prev_sql_fulltext,
10 plsql_entry_object_id,
11 plsql_entry_subprogram_id,
12 plsql_object_id,
13 plsql_subprogram_id
14 from v$session t1
15 where sid = 11 ;
SQL_ID SQL_FULLTEXT PREV_SQL_FULLTEXT c1 c2 c3 c4
------------- -------------------- -------------------- ------ ------ ------ ------
6phkrurssuyjf SELECT B1.OBJECT_NAM BEGIN DBMS_OUTPUT.GE 88503 1
E , B2.USERNAME FROM T_LINES(:LINES, :NUM
ALL_OBJECTS B1 , AL LINES); END;
L_USERS B2
Also looked into this, could not find that.
http://docs.oracle.com/database/121/REFRN/GUID-28E2DC75-E157-4C0A-94AB-117C205789B9.htm#REFRN30223