@@header

set lines 155

COLUMN snap_time  FORMAT a18
COLUMN name       FORMAT a30
COLUMN value      FORMAT a30
COLUMN prev_value FORMAT a30


select snap_time
     , snap_id
     , name
     , value
     , prev_value
from
 (select to_char(s.snap_time,'DD-MON-YY HH24:MI:SS') snap_time
       , s.snap_id
       , p.name
       , p.value
       , lag(p.value) over (partition by p.dbid, p.instance_number, p.name 
                            order by     p.dbid, p.instance_number, p.name, p.snap_id) prev_value
  from stats$parameter p, stats$snapshot s
  where s.dbid = p.dbid
  and s.instance_number = p.instance_number
  and s.snap_id = p.snap_id
  )
where value <> prev_value
and replace(name,'_','!') not like '!!%'
order by snap_time asc;

@@footer