大数据数据

create or replace procedure pcd_event_mintab_perday(intervalNum in number)
is
interval_number number;
begin
interval_num := intervalNum;--范围(1-60)单位:分钟
--总体事件统计
insert into rpt_total_event_start(start_time,end_time,uuid_cnt,dvc_type,custom8)
select start_time,end_time,uuid_cnt,dvc_type,custom8
       from ( select max(start_time) as start_time,max(end_time) as end_time,
            nvl(count(uuid),0) as uuid_cnt,dvc_type,custom8,dd,hh,mi
            from (select t.uuid,t.start_time,t.end_time,t.dvc_type,custom8,
                         to_char(t.end_time,'yyyy-mm-dd') as dd,
                         to_char(t.end_time,'hh24') as hh,
                         to_char(trunc((to_number(to_char(t.end_time,'MI'))/interval_num))) as mi
                  from sim_event t
                  where t.custom8 is not null
                        and(t.end_time >= to_date("2010-03-31 00:00:00",'yyyy-mm-dd hh24:mi:ss')
                        and t.end_time <= to_date("2010-03-31 23:59:59",'yyyy-mm-dd hh24:mi:ss')          
                        )
                  group by dd,hh,mi,dvc_type,custom8                                                           
                
            )
      
       );
commit;
end pcd_event_mintab-perday
/


begin
      sys.dbms_job.submit(
                          job => :job,
                          what => 'pcd_event_mintab_perday(5);',
                          next_date => to_date('13-06-2010','dd-mm-yyyy'),
                          interval => 'trunc(sysdate+4)'
      );
commit;
end;
/

你可能感兴趣的:(大数据)