execute the below statement to get the desired result.

select 'Execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY ('''|| LOCAL_TRAN_ID || ''');'||chr(10)||'commit;'
from dba_2pc_pending order by fail_time;