Find locks present in database - oracle database script

Find locks present in database - Oracle Database Script.

col session_id head 'Sid' form 9999 col object_name head "Table|Locked" form a30 col oracle_username head "Oracle|Username" form a10 TRUNCATE col os_user_name head "OS|Username" form a10 TRUNCATE col process head "Client|Process|ID" form 99999999 col mode_held form a15
SELECT lo.session_id,
       lo.oracle_username,
       lo.os_user_name,
       lo.process,
       do.object_name,
       decode(lo.locked_mode, 0, 'None', 1, 'Null', 2, 'Row Share (SS)', 3, 'Row Excl (SX)', 4, 'Share', 5, 'Share Row Excl (SSX)', 6, 'Exclusive', to_char(lo.locked_mode)) mode_held
FROM v$locked_object lo,
     dba_objects DO
WHERE lo.object_id = do.object_id
ORDER BY 1,
         5 /