Wednesday, May 8, 2013

Concurrent Request Status code and Phase decode in oracle application



SELECT   request_id, status, phase
    FROM (SELECT request_id
                ,DECODE (status_code
                        ,'A', 'Waiting'
                        ,'B', 'Resuming'
                        ,'C', 'Normal'
                        ,'D', 'Cancelled'
                        ,'E', 'Error'
                        ,'F', 'Scheduled'
                        ,'G', 'Warning'
                        ,'H', 'On Hold'
                        ,'I', 'Normal'
                        ,'M', 'No Manager'
                        ,'Q', 'Standby'
                        ,'R', 'Normal'
                        ,'S', 'Suspended'
                        ,'T', 'Terminating'
                        ,'U', 'Disabled'
                        ,'W', 'Paused'
                        ,'X', 'Terminated'
                        ,'Z', 'Waiting'
                        ) status
                ,DECODE (phase_code
                        ,'C', 'Completed'
                        ,'I', 'Inactive'
                        ,'P', 'Pending'
                        ,'R', 'Running'
                        ) phase
                ,ROW_NUMBER () OVER (ORDER BY request_id DESC) rn
            FROM fnd_concurrent_requests
           WHERE Concurrent_program_id = :P1)
   WHERE rn <= 10
ORDER BY 1 DESC;

No comments:

Post a Comment