SELECT USR.USER_ID
FROM syc_smg_usr USR
left join syc_smg_dpt dpt on usr.dept_id = dpt.dept_id
where dpt.dept_level = 3
AND DPT.ZSLIOAN_FLAG_DEPTID = ‘Y’
ORDER BY USR.DEPT_ID;
select count(1)
–into v_wq_count
from wrk_asc_wq wq
where wq.business_type = ‘NBT’
and (wq.user_id = ‘YEXINWEI653’ or nvl(wq.assistant_id,‘0’) = ‘YEXINWEI653’)
and exists
(select 1
from syc_bse_remark r
where r.case_code = wq.acct_sn
and r.created_by = ‘YEXINWEI653’
and r.created_date >= trunc(SYSDATE-60));–0.5秒
select count(distinct(t.CASE_CODE))
–INTO V_MONTH_HANDLE_COUNT
from syc_bse_remark t
where t.business_type = ‘NBT’
and t.created_by = ‘YEXINWEI653’
and t.created_date >=
to_date((to_char(SYSDATE, ‘yyyyMM’) || ‘01’), ‘yyyyMMdd’)–V_DATE
and exists
(select 1
from wrk_asc_wq a
where a.acct_sn = t.CASE_CODE
and (a.user_id = ‘YEXINWEI653’ or
nvl(a.assistant_id, ‘0’) = ‘YEXINWEI653’));-- 10秒左右 有问题
select count(distinct(t.CASE_CODE))
–into v_overdue_handle_count
from syc_bse_remark t, wrk_bse_at at
where t.case_code = at.acct_sn
and t.created_by = ‘YANMING770’ --HUANGJIAO342 YANMING770 WUJUN561 DONGXUAN993
and t.business_type = ‘NBT’ --业务线 NBT ILN
and at.overdue_day <> 0
and exists (select 1
from wrk_asc_wq a
where a.acct_sn = t.CASE_CODE
and (a.user_id = ‘YANMING770’ or nvl(a.assistant_id, ‘0’) = ‘YANMING770’))
and t.created_date>=to_date(to_char(SYSDATE,‘yyyymm’)||‘01’,‘yyyymmdd’);-- 10秒左右 有问题
定义一个变量之间传值 V_MONTH_DATE DATE := to_date((to_char(SYSDATE, ‘yyyyMM’) || ‘01’), ‘yyyyMMdd’);