@@header

/*
*
*  Author     : Vishal Gupta
*  Purpose    : Display resource plan details
*  Parameters : 1 - Resource Plan Name (Use % as wildcard escape with '\', Default value '%')
*                                   
*
*  Revision History:
*  ===================
*  Date       Author        Description
*  ---------  ------------  -----------------------------------------
*  02-Jul-12  Vishal Gupta  Created
*  
*
*/


/************************************
*  INPUT PARAMETERS
************************************/
UNDEFINE PLAN_NAME
DEFINE PLAN_NAME="&&1"  

set term off
COLUMN  _PLAN_NAME          NEW_VALUE  PLAN_NAME             NOPRINT
SELECT DECODE('&&PLAN_NAME','','%','&&PLAN_NAME')   "_PLAN_NAME"
FROM DUAL;
set term on


COLUMN plan                      HEADING "PlanName"                        FORMAT a30
COLUMN sub_plan                  HEADING "Sub|Plan"                        FORMAT a4
COLUMN ctime                     HEADING "Created"                         FORMAT a15
COLUMN mtime                     HEADING "Modified"                        FORMAT a15
COLUMN status                    HEADING "Status"                          FORMAT a5
COLUMN mandatory                 HEADING "Mandatory"                       FORMAT a5
COLUMN num_plan_directives       HEADING "Plan|Direct|ives|(#)"            FORMAT 99
COLUMN cpu_method                HEADING "CPU|Method"                      FORMAT a10
COLUMN mgmt_method               HEADING "MGMT|Method"                     FORMAT a10
COLUMN active_sess_pool_mth      HEADING "Active|Session|Pool|Method"      FORMAT a25
COLUMN parallel_degree_limit_mth HEADING "Parallel|Degree|Limit|Method"    FORMAT a30
COLUMN queueing_mth              HEADING "Queueing|Method"                 FORMAT a12
COLUMN comments                  HEADING "Comments"                        FORMAT a40
COLUMN Details                   HEADING "Details"                         FORMAT a120

SELECT p.plan
     , p.sub_plan                            
     , to_char(o.ctime,'DD-MON-YY HH24:MI') ctime
     , to_char(o.mtime,'DD-MON-YY HH24:MI') mtime
     , p.status                     
     , p.mandatory                  
     , p.num_plan_directives        
     , p.cpu_method                 
     , p.mgmt_method                           
     , p.active_sess_pool_mth                  
     , p.parallel_degree_limit_mth             
     , p.queueing_mth                          
     --, p.comments                              
  FROM dba_rsrc_plans p
     , sys.obj$ o
 WHERE o.obj# = p.plan_id    
   AND upper(p.plan) like upper('&&PLAN_NAME') ESCAPE '\'
ORDER BY p.plan  
;  


@@footer
