set pagesize 999
set linesize 132
select id, name from cond order by name;
prompt Which Database ID
accept DBID
prompt Enter Start Date (mm/dd/yy hh24:mi)
accept BeginDate
prompt Enter End Date (mm/dd/yy hh24:mi)
accept EndDate
prompt How many Wait Events should be displayed
accept HowMany
column name format a60
select id, name from conf_&DBID order by name;
prompt Enter the File ID
accept FileID
column event_name format a30
select name event_name, timesecs from (
select ev.name, sum(sw.qp/100) timesecs
FROM consw_&DBID sw, conf_&DBID f, conev_&DBID ev
where sw.d between to_date('&BeginDate','mm/dd/yy hh24:mi') and to_date('&EndDate','mm/dd/yy hh24:mi')
and sw.kxpi = f.orafilenum
and f.id = &FileID
and sw.keeq = ev.id
group by ev.name
order by sum(sw.qp/100) desc)
where rownum <= &HowMany
/