3,488
社区成员




select count(1)
from (select a.id, c.startdate, c.finishdate
from T_LAW_CHECKLOG a, all_flowid b, rs_wf_entry c
where a.id = b.rcjc_id(+)
and b.rcjc_fid = c.id(+)
and c.finishdate is not null
and c.finishdate >= c.startdate
and to_date(substr(a.creatime, 0, 8), 'yyyymmdd') >=
to_date('2015-01-01', 'yyyy-mm-dd')
and to_date(substr(a.creatime, 0, 8), 'yyyymmdd') <=
to_date('2015-06-01', 'yyyy-mm-dd')
UNION ALL
select distinct b.id, c.startdate, c.finishdate
from T_LAW_CHECKLOG a, T_LAW_REPORT b, rs_wf_entry c
where a.REPORT_ID = b.id(+)
and b.PROCESSINSTID = c.id(+)
and c.finishdate is not null
and c.finishdate >= c.startdate
and to_date(substr(b.report_time, 0, 8), 'yyyymmdd') >=
to_date('2015-01-01', 'yyyy-mm-dd')
and to_date(substr(b.report_time, 0, 8), 'yyyymmdd') <=
to_date('2015-06-01', 'yyyy-mm-dd')
UNION ALL
select d.id, c.startdate, c.Finishdate
from T_LAW_CHECKLOG a,
T_LAW_REGISTER b,
T_LAW_DISPOSE d,
rs_wf_entry c
where d.REGISTER_ID = b.id(+)
and b.CHK_ID = a.id(+)
and d.cfjd_entry_id = c.id(+)
and instr(d.wf_law_ids, '402880c14389691901438a6c384200b9') > 0
and c.Finishdate is not null
and c.startdate <= c.Finishdate
and to_date(substr(d.CREATIME, 0, 8), 'yyyymmdd') >=
to_date('2015-01-01', 'yyyy-mm-dd')
and to_date(substr(d.CREATIME, 0, 8), 'yyyymmdd') <=
to_date('2015-06-01', 'yyyy-mm-dd')) al
select SUM(n)
from (select count(1) as n
from T_LAW_CHECKLOG a, all_flowid b, rs_wf_entry c
where a.id = b.rcjc_id(+)
and b.rcjc_fid = c.id(+)
and c.finishdate is not null
and c.finishdate >= c.startdate
and a.creatime >= '20050101'
and a.creatime < '20150602'
UNION ALL
select count(distinct b.id) as n
from T_LAW_CHECKLOG a, T_LAW_REPORT b, rs_wf_entry c
where a.REPORT_ID = b.id(+)
and b.PROCESSINSTID = c.id(+)
and c.finishdate is not null
and c.finishdate >= c.startdate
and b.report_time >= '20050101'
and b.report_time < '20150602'
UNION ALL
select count(1) as n
from T_LAW_CHECKLOG a,
T_LAW_REGISTER b,
T_LAW_DISPOSE d,
rs_wf_entry c
where d.REGISTER_ID = b.id(+)
and b.CHK_ID = a.id(+)
and d.cfjd_entry_id = c.id(+)
-- 下面这个性能太差,能不能改成直接比较?
and instr(d.wf_law_ids, '402880c14389691901438a6c384200b9') > 0
and c.Finishdate is not null
and c.startdate <= c.Finishdate
and d.CREATIME >= '20050101'
and d.CREATIME < '20150602'
) al