cursor my_own is
select c536870939 ,c536871050 ,c536871023 , c536870934 , c536870937 ,c536970981 ,
c536871026 ,c536871027 , c536870975 , c3
from ARADMIN.T359
where c3>=(to_date(to_char(sysdate-181,'yyyy-mm-dd ')||'18:00:00','yyyy-mm-dd hh24:mi:ss')
-to_date('1970-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss'))*86400 - 28800
and c3<=(to_date(to_char(sysdate-180,'yyyy-mm-dd ')||'18:00:00','yyyy-mm-dd hh24:mi:ss')
-to_date('1970-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss'))*86400 - 28800
order by c536870939,c3;
v_s my_own%ROWTYPE;
begin
open my_own;
loop
begin
fetch my_own into v_s;
exit when my_own%NOTFOUND;
if v_s.c536871050 in ('EOMS:Incidents')
then
select c536871090 ,t2.c536870915 ,t1.c536871080 , t1.c536870923
into create_people_run,create_part_run,do_limit_time_run,guidang_time_run
from ARADMIN.T385 t1,ARADMIN.T61 t2
where t1.c1=v_s.c536870939 and t1.c536871090=t2.c240000001||'.' ;--and t1.c536870924 not in(0,4) ;
select max(c3)
into compare_time
from ARADMIN.T359
where c3<v_s.c3;
select c536870937 , c536970981
into pre_people_run,pre_part_run
from ARADMIN.T359
where c3=compare_time;
insert into ARADMIN.MIDDLE_TABLE
(
ARADMIN.MIDDLE_TABLE.REF_NUM ,
ARADMIN.MIDDLE_TABLE.REF_TYPE ,
ARADMIN.MIDDLE_TABLE.CREATE_PEOPLE ,
ARADMIN.MIDDLE_TABLE.CREATE_PART ,
ARADMIN.MIDDLE_TABLE.PROCESS_PEOPLE ,
ARADMIN.MIDDLE_TABLE.PROCESS_PART ,
ARADMIN.MIDDLE_TABLE.OK_PROCESS_TIME ,
ARADMIN.MIDDLE_TABLE.PROCESS_LIMIT_TIME ,
ARADMIN.MIDDLE_TABLE.START_TIME ,
ARADMIN.MIDDLE_TABLE.END_TIME ,
ARADMIN.MIDDLE_TABLE.DO_LIMIT_TIME ,
ARADMIN.MIDDLE_TABLE.GUIDANG_TIME ,
ARADMIN.MIDDLE_TABLE.GUIDANG_LIMIT_TIME ,
ARADMIN.MIDDLE_TABLE.PRE_ID ,
ARADMIN.MIDDLE_TABLE.PRE_PEOPLE ,
ARADMIN.MIDDLE_TABLE.PRE_PART ,
ARADMIN.MIDDLE_TABLE.CREATE_PROCESS_TIME ,
ARADMIN.MIDDLE_TABLE.MYTIME
)
values
(
v_s.c536870939,
v_s.c536871050,
create_people_run,
create_part_run,
v_s.c536870937,
v_s.c536970981,
v_s.c536870934,
do_limit_time_run,
v_s.c536871026,
v_s.c536871027,
do_limit_time_run,
guidang_time_run,
do_limit_time_run,
v_s.c536870975,
pre_people_run,
pre_part_run,
v_s.c3,
to_char(sysdate,'yyyymmdd')
);
end if;
select c536870939 ,c536871050 ,c536871023 , c536870934 , c536870937 ,c536970981 ,
c536871026 ,c536871027 , c536870975 , c3
from ARADMIN.T359
where c3>=(to_date(to_char(sysdate-181,'yyyy-mm-dd ')||'18:00:00','yyyy-mm-dd hh24:mi:ss')
-to_date('1970-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss'))*86400 - 28800
and c3<=(to_date(to_char(sysdate-180,'yyyy-mm-dd ')||'18:00:00','yyyy-mm-dd hh24:mi:ss')
-to_date('1970-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss'))*86400 - 28800
order by c536870939,c3;
v_s my_own%ROWTYPE;
begin
open my_own;
loop
begin
fetch my_own into v_s;
exit when my_own%NOTFOUND;
if v_s.c536871050 in ('EOMS:Incidents')
then
select c536871090 ,t2.c536870915 ,t1.c536871080 , t1.c536870923
into create_people_run,create_part_run,do_limit_time_run,guidang_time_run
from ARADMIN.T385 t1,ARADMIN.T61 t2
where t1.c1=v_s.c536870939 and t1.c536871090=t2.c240000001||'.' ;--and t1.c536870924 not in(0,4) ;
select max(c3)
into compare_time
from ARADMIN.T359
where c3<v_s.c3;
select c536870937 , c536970981
into pre_people_run,pre_part_run
from ARADMIN.T359
where c3=compare_time;
insert into ARADMIN.MIDDLE_TABLE
(
ARADMIN.MIDDLE_TABLE.REF_NUM ,
ARADMIN.MIDDLE_TABLE.REF_TYPE ,
ARADMIN.MIDDLE_TABLE.CREATE_PEOPLE ,
ARADMIN.MIDDLE_TABLE.CREATE_PART ,
ARADMIN.MIDDLE_TABLE.PROCESS_PEOPLE ,
ARADMIN.MIDDLE_TABLE.PROCESS_PART ,
ARADMIN.MIDDLE_TABLE.OK_PROCESS_TIME ,
ARADMIN.MIDDLE_TABLE.PROCESS_LIMIT_TIME ,
ARADMIN.MIDDLE_TABLE.START_TIME ,
ARADMIN.MIDDLE_TABLE.END_TIME ,
ARADMIN.MIDDLE_TABLE.DO_LIMIT_TIME ,
ARADMIN.MIDDLE_TABLE.GUIDANG_TIME ,
ARADMIN.MIDDLE_TABLE.GUIDANG_LIMIT_TIME ,
ARADMIN.MIDDLE_TABLE.PRE_ID ,
ARADMIN.MIDDLE_TABLE.PRE_PEOPLE ,
ARADMIN.MIDDLE_TABLE.PRE_PART ,
ARADMIN.MIDDLE_TABLE.CREATE_PROCESS_TIME ,
ARADMIN.MIDDLE_TABLE.MYTIME
)
values
(
v_s.c536870939,
v_s.c536871050,
create_people_run,
create_part_run,
v_s.c536870937,
v_s.c536970981,
v_s.c536870934,
do_limit_time_run,
v_s.c536871026,
v_s.c536871027,
do_limit_time_run,
guidang_time_run,
do_limit_time_run,
v_s.c536870975,
pre_people_run,
pre_part_run,
v_s.c3,
to_char(sysdate,'yyyymmdd')
);
end if;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货