delete from stats$sql_summary 
where (SNAP_ID, DBID, INSTANCE_NUMBER, OLD_HASH_VALUE, TEXT_SUBSET)
in (  SELECT ss.SNAP_ID, ss.DBID, ss.INSTANCE_NUMBER, ss.OLD_HASH_VALUE, ss.TEXT_SUBSET
        FROM stats$sql_summary ss,
             stats$statspack_parameter sp
       WHERE ss.dbid = sp.dbid
         AND ss.instance_number = sp.instance_number
         AND ss.EXECUTIONS < sp.EXECUTIONS_TH * 1
         AND ss.parse_calls < sp.PARSE_CALLS_TH * 1
         AND ss.disk_reads  < sp.DISK_READS_TH * 1
         AND ss.buffer_gets < sp.BUFFER_GETS_TH * 1
         AND ss.sharable_mem < sp.SHARABLE_MEM_TH * 1
         AND  ss.version_count < sp.VERSION_COUNT_TH * 1 
   )
;

commit;



