前言:
那些年我写过的存储过程和计划任务,先将其写成博客,归纳总结,方便以后查看。
目录:
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 where a.type_code = '005' 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) C, (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 = '006' 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) D, (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 = '007' 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) E, (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 = '008' 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) F, (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 = '009' 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) G where s.area_no = a.area_no(+) and s.area_no = b.area_no(+) and s.area_no = c.area_no(+) and s.area_no = d.area_no(+) and s.area_no = e.area_no(+) and s.area_no = f.area_no(+) and s.area_no = g.area_no(+) and s.req_date = a.req_date(+) and s.req_date = b.req_date(+) and s.req_date = c.req_date(+) and s.req_date = d.req_date(+) and s.req_date = e.req_date(+) and s.req_date = f.req_date(+) and s.req_date = g.req_date(+) order by to_date(s.req_date, 'yyyy-mm-dd') desc; commit; end; 3:创建访问量存储过程 create or replace procedure visit_statis_pro is begin delete from w_visit_statistics@dbltest; insert into w_visit_statistics@dbltest select '01', to_date(to_char(t.visit_first_action_time, 'yyyy-mm-dd'), 'yyyy-mm-dd'), sum(t.visit_total_actions) from w_log_visit t where to_char(t.visit_first_action_time, 'yyyy-mm-dd') < to_char(sysdate, 'yyyy-mm-dd') group by to_char(t.visit_first_action_time, 'yyyy-mm-dd'); commit; end; 4:计划任务:明天0晨执行定时任务 declare v_job number; begin sys.dbms_job.submit( v_job, 'bind_statis_pro;busi_statis_pro;visit_statis_pro;', sysdate, 'sysdate+1'); commit; end; ---------------------------------用户库---------------------------------------------------- 5:创建注册用户数存储过程 create or replace procedure regist_statis_pro is begin insert into w_regist_statistics@dbltest select t.area_no, '01', to_date(to_char(t.reg_date, 'yyyy-mm-dd'), 'yyyy-mm-dd'), count(0) from w_users t where to_char(t.reg_date, 'yyyy-mm-dd') < to_char(sysdate, 'yyyy-mm-dd') group by t.area_no, to_char(t.reg_date, 'yyyy-mm-dd'); commit; end; 6:创建计划任务:明天凌晨定时执行存储过程 declare v_job number; begin sys.dbms_job.submit( v_job, 'regist_statis_pro;', sysdate, 'sysdate+1'); commit; end;
7.相似博客推荐
相关推荐
oracle存储过程+日期+定时任务Job oracle存储过程+日期+定时任务Job oracle存储过程+日期+定时任务Job
帮助解决Oracle中存储过程自动备份得脚本及添加任务计划过程得详细解说 帮助解决Oracle中存储过程自动备份得脚本及添加任务计划过程得详细解说
在ORACLE数据库实际应用过程中有些业务逻辑处理量大并且复杂,使客户端调用存储过程后,长时间没有反应,也不知存储过程运行状态,本文讲述如何在ORACLE通过任务和管道的应用,异步调用存储过程的方法。
Oracle定时执行存储过程,讲解非常的详细,千万不要错过哦!
本文讲述如何在Oracle通过任务和管道的应用,异步调用存储过程的方法。并且介绍了其基本原理和具体实现测试。
NULL 博文链接:https://ysj5125094.iteye.com/blog/1665926
oracle存储过程超详细使用手册,让你更好得了解储存过程。
NULL 博文链接:https://xiaosheng12345.iteye.com/blog/1984408
我接到编写ORACLE存储过程的任务,我是程序员,脑袋里只有一些如何使用CALLABLE接口调用存储过程的经验,一时不知如何下手,我查阅了一些资料,通过实践发现编写ORACLE存储过程是非常不容易的工作,即使上路以后,...
oracle job调度存储过程 触发器 定时更新数据库
plsql创建存储过程并创建job定时任务执行-详细笔记文档总结
oracle数据库同步perl脚本示例 其中有2个文件,一个是 perl同步脚本,另一个是存储过程; 大致思路是:perl脚本从数据库A同步数据至库B的临时表中,再通过存储过程将库B中的临时数据过滤导入正式数据当中。
Oracle 定时删除数据 并释放空间 ,创建存储过程并使用job完成。
Oracle JOB 定时任务 定时执行存储过程
oracle定时执行存储过程,方便大家备份数据,执行复杂操作
存储过程修改,关于oracle存储过程修改及定时任务的设定
job_action => 'AGENT_LIQUIDATION.LIQUIDATION', --存储过程名 start_date => sysdate, repeat_interval => 'FREQ=MONTHLY; INTERVAL=1; BYMONTHDAY=1;BYHOUR=1;BYMINUTE=0;BYSECOND=0', -- 按月,间隔为1个...
存储过程是存储在服务器上的 Transact-SQL 语句的命名集合,是封装重复性任务的方法。支持用户声明变量、条件执行以及其他强有力的编程特性
Oracle 自动备份详细步骤 背景:Oracle 10g 服务器,Oracle 10g 客户端,windowsXP 操作平台 ...解决方案:利用任务计划、批处理文件和 Oracle 的 exp 导出功能,根据日期自动生成 Oracle 备份文件。详细步骤:
通过使用Oracle作为中间容器编写存储过程,...最初项目经理给出了几种方案,第一种是写定时任务定时的去取数据,第二种就是写存储过程去同步数据,无论哪种方式都需要有几个原则,首先是无论哪种方式都不可以直接在甲方