V$SESSION dynamic contains all the currently active users' usernames and the SQL they are executing in the database.
SQL>
SQL> select a.username,
2 s.sql_text
3 from v$session a,v$sqltext s
4 where a.sql_address = s.address
5 and a.sql_hash_value = s.hash_value
6 AND A.STATUS='ACTIVE'
7 order by a.username,a.sid,s.piece
8 /
USERNAME
------------------------------
SQL_TEXT
--------------------------------------------------
JAVA2S
select a.username, s.sql_text from v$session a,v$s
qltext s where
JAVA2S
a.sql_address = s.address and a.sql_hash_value =
s.hash_value A
JAVA2S
ND A.STATUS='ACTIVE' order by a.username,a.sid,s.p
iece
JAVA2S
DECLARE v_MyNumber NUMBER := 0; BEGIN LOOP
IF v_
JAVA2S
MyNumber = 7 THEN EXIT; END IF;
v_MyNumber
USERNAME
------------------------------
SQL_TEXT
--------------------------------------------------
JAVA2S
:= v_MyNumber + 2; END LOOP; END;
6 rows selected.
SQL>
SQL> --
Related examples in the same category