SELECT
A.USERNAME,
A.MACHINE,
A.PROGRAM,
A.SID,
A.SERIAL#,
A.STATUS,
C.PIECE,
C.SQL_TEXT
FROM
V$SESSION A,
V$SQLTEXT C
WHERE
A.SID IN ( SELECT DISTINCT T2.SID FROM V$LOCKED_OBJECT T1, V$SESSION T2 WHERE T1.SESSION_ID = T2.SID )
AND A.SQL_ADDRESS = C.ADDRESS ( + )
ORDER BY
C.PIECE;