Thursday, April 4, 2013

Average Runtime of Concurrent Programs

  SELECT fcp.description "Description",
         concurrent_program_name "Program",
         TRUNC (
            AVG (
               (TO_NUMBER (TO_CHAR (actual_completion_date, 'SSSSS'))
                - TO_NUMBER (TO_CHAR (actual_start_date, 'SSSSS')))
               / 60),
            2)
            "Time in Min."
    FROM fnd_concurrent_programs_vl fcp, fnd_concurrent_requests fcr
   WHERE fcp.application_id = fcr.program_application_id
         AND fcp.concurrent_program_id = fcr.concurrent_program_id
         AND TO_CHAR (actual_completion_date, 'DD-MON-YY') =
                TO_CHAR (actual_start_date, 'DD-MON-YY')
GROUP BY concurrent_program_name, fcp.description
ORDER BY fcp.description;