@@header

/*
*
*  Author     : Vishal Gupta
*  Purpose    : Display all SQL PLAN Baselines
*  Parameters : 
*          
*
*  Revision History:
*  ===================
*  Date       Author        Description
*  ---------  ------------  -----------------------------------------
*  12-Jun-12  Vishal Gupta  First created
*
*/

COLUMN  sql_handle         HEADING "SQL Handle"                   FORMAT a20
COLUMN  enabled            HEADING "Ena|bled"                     FORMAT a4
COLUMN  accepted           HEADING "Accep|ted"                    FORMAT a5
COLUMN  fixed              HEADING "Fixed"                        FORMAT a5
COLUMN  reproduced         HEADING "Repro|duced"                  FORMAT a5
COLUMN  autopurge          HEADING "Auto|Purge"                   FORMAT a5
COLUMN  optimizer_cost     HEADING "Optimizer|Cost"               FORMAT 99999999
COLUMN  creator            HEADING "Creator"                      FORMAT a12
COLUMN  created            HEADING "Created"                      FORMAT a15
COLUMN  last_modified      HEADING "LastModified"                 FORMAT a15
COLUMN  last_executed      HEADING "LastExecuted"                 FORMAT a15
COLUMN  last_verified      HEADING "LastVerified"                 FORMAT a15
COLUMN  force_matching     HEADING "Force|Match"                  FORMAT a5
COLUMN  signature          HEADING "Signature"                    FORMAT 999999999999999999999
COLUMN  description        HEADING "Description"                  FORMAT a50

BREAK ON name ON CATEGORY ON created ON last_modified ON type ON status ON force_matching ON signature ON description

SELECT spb.sql_handle
     , spb.plan_name
     , spb.origin
     , spb.enabled
     , spb.accepted
     , spb.fixed
     , spb.reproduced
     , spb.autopurge
     , spb.optimizer_cost
     , spb.creator
     , to_char(spb.created,'DD-MON-YY HH24:MI') created
     , to_char(spb.last_modified,'DD-MON-YY HH24:MI') last_modified
     , to_char(spb.last_executed,'DD-MON-YY HH24:MI') last_executed
     , to_char(spb.last_verified,'DD-MON-YY HH24:MI') last_verified
     , spb.description
  FROM dba_sql_plan_baselines spb
ORDER BY spb.last_modified DESC  
;  

@@footer
