Oracle快速创建定时job执行批量转储过程脚本参考案例
2012-09-04 08:01
579 查看
-- 创建短信批量转储存储过程,将已经发送的短信转移至短信历史表
create or replace procedure PUB_SHORTMSG_ARCH_BAT
as
MSG_ID pub_shortmsg_td.shotmsg_id%type;-
cursor cur_msg is
select shotmsg_id from pub_shortmsg_td a where a.send_flag!=0;
cur_rec cur_msg%rowtype;
begin
open cur_msg;
loop
fetch cur_msg into cur_rec;
exit when cur_msg%notfound;
MSG_ID := cur_rec.shotmsg_id;
insert into his_pub_shortmsg_td (select * from pub_shortmsg_td where shotmsg_id=MSG_ID);
delete pub_shortmsg_td where shotmsg_id=MSG_ID;
COMMIT;
end loop;
close cur_msg;
end PUB_SHORTMSG_ARCH_BAT;
-- 建立job,每天凌晨1:30执行已发送短信的历史转储
VARIABLE job NUMBER;
begin
sys.dbms_job.submit(job => :job,
what => 'PUB_SHORTMSG_ARCH_BAT();',
next_date => to_date('30-08-2008 01:30:05', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'sysdate+1');
commit;
end;
/
create or replace procedure PUB_SHORTMSG_ARCH_BAT
as
MSG_ID pub_shortmsg_td.shotmsg_id%type;-
cursor cur_msg is
select shotmsg_id from pub_shortmsg_td a where a.send_flag!=0;
cur_rec cur_msg%rowtype;
begin
open cur_msg;
loop
fetch cur_msg into cur_rec;
exit when cur_msg%notfound;
MSG_ID := cur_rec.shotmsg_id;
insert into his_pub_shortmsg_td (select * from pub_shortmsg_td where shotmsg_id=MSG_ID);
delete pub_shortmsg_td where shotmsg_id=MSG_ID;
COMMIT;
end loop;
close cur_msg;
end PUB_SHORTMSG_ARCH_BAT;
-- 建立job,每天凌晨1:30执行已发送短信的历史转储
VARIABLE job NUMBER;
begin
sys.dbms_job.submit(job => :job,
what => 'PUB_SHORTMSG_ARCH_BAT();',
next_date => to_date('30-08-2008 01:30:05', 'dd-mm-yyyy hh24:mi:ss'),
interval => 'sysdate+1');
commit;
end;
/
相关文章推荐
- oracle job 定时执行 存储过程
- oracle 创建job定时执行任务
- oracle下定时执行过程脚本
- oracle创建定时job,job调用存储过程,批量查询,批量修改,自定义数据类型,
- oracle job 定时执行 存储过程
- oracle 创建存储过程 在job 定时执行
- oracle job 定时执行 存储过程
- oracle 中的定时执行存储过程的job
- oracle设置定时任务job调度执行存储过程或pl/sql代码块
- Oracle:创建JOB定时执行存储过程
- oracle中创建job的用法(定时执行数据库)
- Oracle Job 定时执行一个存储过程
- ORACLE 11G在存储过程里面遍历游标, 调用job任务定时执行
- JOB的创建,定时,执行
- oracle job 定时,启动,停止,察看状态。运行脚本
- Oracle JOB的建立,定时执行任务
- 利用oracle的job定时执行任务
- oracle job定时执行存储过程
- oracle job有定时执行功能
- Oracle利用job实现定时执行任务