select	a.sid, a.serial#, a.username, a.process, substr(a.MACHINE,1,20), to_char(a.LOGON_TIME, 'yyyymmddhh24miss' ), 
	b.object_name,
	decode(c.lmode, 2, 'RS', 3, 'RX', 4, 'S', 5, 'SRX', 8, 'X', 'NO') TABLE_LOCK, 
	decode(a.command, 2, 'INSERT',3, 'SELECT',6, 'UPDATE', 7, 'DELETE', 12, 'DROP',6, 'LOCK', 'unknown') SQL,
	decode(a.lockwait, NULL, 'No Wait', 'Wait') STATUS
from V$SESSION a, DBA_OBJECTS b, V$LOCK c
where	a.sid = c.sid and b.object_id = c.id1
and	c.type = 'TM'
and	a.username = 'SCOTT'
order by 6;