SELECT (SELECT USERNAME FROM v$session WHERE SID = a.SID) AS blocker,
a. SID,
' is blocking ',
(SELECT USERNAME FROM v$session WHERE SID = b. SID) AS blockee,
b. SID
FROM v$lock a,
v$lock b
WHERE a.BLOCK = 1 AND b.REQUEST > 0 AND a.ID1 = b.ID1 AND a.ID2 = b.ID2;