SELECT
sql_id, COUNT(DISTINCT plan_hash_value)
FROM
dba_hist_sqlstat stat,
dba_hist_snapshot ss
WHERE
stat.snap_id = ss.snap_id
AND ss.dbid = stat.dbid
AND ss.instance_number = stat.instance_number
AND ss.begin_interval_time >= sysdate – 7
AND ss.end_interval_time <= sysdate AND stat.plan_hash_value <> 0
AND stat.executions_delta > 0
AND stat.parsing_schema_name NOT IN ( ‘SYS’, ‘SYSTEM’ )
GROUP BY
sql_id
having COUNT(DISTINCT plan_hash_value) >1
ORDER BY
1;