sql - 自动化 PL/SQL 过程
问题描述
我在 pl/sql 程序下创建了。我想安排它每天执行。我正在使用 dbms.job 来安排它在每天的特定时间运行。程序编译成功。但是虽然我安排了它并没有自动执行。
CREATE OR REPLACE PROCEDURE Schema.Payment_Updation_Process
AS
BEGIN
dbms_output.put_line ('The payments updation process started at '|| rpad(' ',0,' ')||SYSDATE);
EXECUTE IMMEDIATE 'drop table account_new_arr_1'
;
update tab_dld
set dr_date = sysdate
where table_name = 'account_new_arr_1'
and dr_date is null
;
commit
;
insert into tab_dld
values ('account_new_arr_1',sysdate,null,null,null,tab_dld_seq.nextval)
;
commit
;
EXECUTE IMMEDIATE 'create table account_new_arr_1
tablespace TOOLS
storage (initial 1M next 1M)
as (
select t1.customer_segment,t2.account_num,t2.last_bill_seq,
round((t2.total_billed_tot - t2.total_paid_tot);1000,2) new_arr
from accountattributes t1, account t2
where t1.customer_segment in (''01'',''05'',''31'',''32'',''36'',''37'')
and t2.account_num = t1.account_num
and t2.invoicing_co_id = 1
and to_char(t2.last_bill_dtm,''YYYYMM'') > ''201204''
and t2.currency_code = ''LKR''
)'
;
update tab_dld
set en_date = sysdate,
cc = (select count(*)
from account_new_arr_1)
where table_name = 'account_new_arr_1'
and en_date is null
and dr_date is null
;
commit
;
EXECUTE IMMEDIATE 'create index i_account_new_arr_1
on account_new_arr_1(account_num)
tablespace TOOLS
storage (initial 1M next 1M)'
;
END;
/
这是我试图安排的方式。
declare
jid number;
begin
dbms_job.submit(
JOB => jid,
WHAT => 'Payment_Updation_Process;',
NEXT_DATE => to_timestamp_tz('09-JULY-21 08.28.00 Asia/Calcutta',
'DD-MON-RR HH24:MI:SS TZR'),
INTERVAL => 'sysdate +1');
end;
/
commit;
当使用 ' select * from user_jobs;
' 检查状态时,它会显示失败。有谁知道原因?
解决方案
推荐阅读
- javascript - sorttable.js 在服务器上工作,但在内联时不行
- java - Maven,继承 pom 模块
- ios - CoreData 一对一关系:重新启动应用程序后对象为零
- sendgrid - Sendgrid 是否按收件人向您收费?
- javascript - 禁用表单提交 JQuery 上的按钮后,使用按钮名称将表单提交给 PHP
- vb.net - 如何调整大小和图像并保存为字节数组
- javascript - 如何在不覆盖先前值的情况下将多个值设置为同一个键?
- vba - 在 VBA 中使用 2 个向量的元素创建消息
- android - 如何使用 Intent 在 kotlin 中放置数据类列表
- generics - 是否可以在 Rust 中编写通用整数长度函数?