前言: ??
? ? 那些年我写过的存储过程和计划任务,先将其写成博客,归纳总结,方便以后查看。
目录:
?? 1. 创建绑定用户数存储过程
?? 2. 创建业务统计数据存储过程
?? 3. 创建访问量存储过程
?? 4. 计划任务:明天0晨执行定时任务
?? 5. 创建注册用户数存储过程
?? 6. 创建计划任务:明天凌晨定时执行存储过程
?? 7. 相似博客推荐
?
---------------------全局库--------------------------------
1:创建绑定用户数存储过程
create or replace procedure bind_statis_pro is
begin
delete from w_bind_statistics@dbltest;
insert into w_bind_statistics@dbltest
select t.organ_code,
'01',
to_date(to_char(t.bind_time, 'yyyy-mm-dd'), 'yyyy-mm-dd'),
count(0)
from w_busi_user_bind t
where to_char(t.bind_time, 'yyyy-mm-dd') <
to_char(sysdate, 'yyyy-mm-dd')
group by t.organ_code, to_char(t.bind_time, 'yyyy-mm-dd');
commit;
end;
2:创建业务统计数据存储过程
create or replace procedure busi_statis_pro is
begin
delete from w_busi_statistics@dbltest;
insert into w_busi_statistics@dbltest
select s.area_no,
'01',
to_date(s.req_date, 'yyyy-mm-dd'),
nvl(a.count, 0),
nvl(b.count, 0),
nvl(c.count, 0),
nvl(d.count, 0),
nvl(e.count, 0),
nvl(f.count, 0),
nvl(g.count, 0)
from (select a.area_no,
to_char(a.req_date, 'yyyy-mm-dd') req_date,
count(0) count
from pub_queue_app a
where to_char(a.req_date, 'yyyy-mm-dd') <
to_char(sysdate, 'yyyy-mm-dd')
group by a.area_no, to_char(a.req_date, 'yyyy-mm-dd')) S,
(select a.area_no,
to_char(a.req_date, 'yyyy-mm-dd') req_date,
a.type_code,
count(0) count
from pub_queue_app a
where a.type_code = '001'
and to_char(a.req_date, 'yyyy-mm-dd') <
to_char(sysdate, 'yyyy-mm-dd')
group by a.area_no,
to_char(a.req_date, 'yyyy-mm-dd'),
a.type_code) A,
(select a.area_no,
to_char(a.req_date, 'yyyy-mm-dd') req_date,
a.type_code,
count(0) count
from pub_queue_app a
where a.type_code = '003'
and to_char(a.req_date, 'yyyy-mm-dd') <
to_char(sysdate, 'yyyy-mm-dd')
group by a.area_no,
to_char(a.req_date, 'yyyy-mm-dd'),
a.type_code) B,
(select a.area_no,
to_char(a.req_date, 'yyyy-mm-dd') req_date,
a.type_code,
count(0) count
from pub_queue_app a
w