set pages 99
set lines 200

select session_id, event, count(*), sum(time_waited)
from gv$active_session_history
where session_state=’WAITING’
and time_waited>0
and sample_time >=(sysdate-&MinutesBack/(24*60))
group by session_id,event;