rem ********************************************************************
rem * Filename          : %M% - Version %I%
rem * Author            : Dave Cook
rem * Original          : 28-FEB-95
rem * Last Update       : %H% - %T%
rem * Description       : Shows individuall concurrent request stat's for
rem *                     capacity planning purposes.
rem * Usage             : start cmwork.sql <date>  e.g. 03-MAR-95
rem *                                        <Program Name>
rem *                                        <Max run time (min.)>
rem *
rem ********************************************************************

rem cmwork.sql

def end_date=&&1

col manager_name format a20             heading 'Manager Name'  justify c
col tot_min      format 999,999,990.00  heading 'Tot Minutes'   justify c

select  a.concurrent_queue_name manager_name,
        sum((c.actual_completion_date - c.actual_start_date) * (24*60)) tot_min
from fnd_concurrent_queues a,
     fnd_concurrent_processes b,
     fnd_concurrent_requests c
where c.controlling_manager = b.concurrent_process_id
  and b.concurrent_queue_id = a.concurrent_queue_id
  and c.status_code = 'C'
  and to_char(c.actual_start_date,'DD-MON-YY') = '&end_date'
group by a.concurrent_queue_name
order by 1;
