Oracle PL/SQL/System Tables Views/session
Create view on v$session
SQL>
SQL> CREATE VIEW session_log AS
2 SELECT *
3 FROM v$session
4 WHERE username = USERNAME;
SQL>
SQL> select * from session_log;
SQL>
SQL>
SQL> SELECT username, sid, serial#, module, action
2 FROM session_log;
SQL>
SQL>
SQL> drop view session_log;
Query v$lock, v$session table
SQL>
SQL> set echo on;
SQL>
SQL> create table t1 ( x int );
Table created.
SQL> create table t2 ( x int );
Table created.
SQL>
SQL> insert into t1 values ( 1 );
1 row created.
SQL> insert into t2 values ( 1 );
1 row created.
SQL>
SQL> select username, v$lock.sid, id1, id2, lmode, request, block, v$lock.type
2 from v$lock, v$session
3 where v$lock.sid = v$session.sid and v$session.username = USER
4 /
USERNAME SID ID1 ID2 LMODE REQUEST BLOCK TY
------------------------------ ---------- ---------- ---------- ---------- ---------- ---------- --
sqle 23 16651 1 3 0 0 TO
sqle 23 8655 1 3 0 0 TO
sqle 23 16944 1 3 0 0 TO
sqle 24 0 22 6 0 0 JQ
sqle 38 0 21 6 0 0 JQ
sqle 23 16999 0 3 0 0 TM
sqle 23 17000 0 3 0 0 TM
sqle 23 655364 647 6 0 0 TX
8 rows selected.
Query v$session table
SQL>
SQL> SELECT username, sid, serial#, module, action
2 FROM v$session
3 WHERE row < 50;
WHERE row < 50
*
ERROR at line 3:
ORA-00936: missing expression
SQL>