@@header

/*
*
*  Author     : Vishal Gupta
*  Purpose    : Display SQL Monitor Report
*  Parameters : 1 - SQL_ID
*               2 - type (text, html, active, xml)
*               
*
*  Revision History:
*  ===================
*  Date       Author        Description
*  ---------  ------------  -----------------------------------------
*  16-Mar-12  Vishal Gupta  Intial version
*  09-Oct-12  Vishal Gupta  Set the default value of type='text'
*
*
*/


DEFINE sqlid="&&1"
DEFINE type="&&2"


set pages 0
set linesize 1000
set long 1000000
set longchunksize 1000000

select dbms_sqltune.report_sql_monitor(
           sql_id=>'&sqlid'
          ,inst_id=> null
          ,report_level=> 'ALL +PLAN_HISTOGRAM'
          ,type=>CASE WHEN '&&type' = '' OR '&&type' IS NULL THEN 'text' ELSE '&&type' END) 
from dual;


@@footer
