select 
  vs1.username || '(' || vs1.sid || ':'||vs1.serial#||')' LOCK_HOLD,
  substr(vs1.program,1,14) LOCK_PROGRAM,
  vs1.process LOCK_PROCESS,
  vs1.terminal LOCK_TERM,
  do.owner||'.'||do.object_name LOCK_OBJECT,
  vs2.username || '(' || vs2.sid || ':'||vs2.serial#||')' LOCK_WAIT,
  substr(vs2.program,1,14) WAIT_PROGRAM,
  vs2.process WAIT_PROCESS,
  vs2.terminal WAIT_TERM ,
  vst1.sql_text LOCK_SQL,
  vst2.sql_text WAIT_SQL
from 
  v$session vs1, 
  dba_objects do, 
  v$lock vl, 
  v$session vs2,
  v$sqltext vst1,
  v$sqltext vst2
where vl.id1 = do.object_id
  and vs1.sid = vl.sid
  and vs1.lockwait is null
  and vs2.lockwait is not null
  and vl.type = 'TM'
  and vst1.address = vs1.sql_address
  and vst1.hash_value = vs1.sql_hash_value
  and vst2.address = vs2.sql_address
  and vst2.hash_value=vs2.sql_hash_value
order by 1, 2, 3
