
是不是一个JOB只能定时执行一个存储过程
1个回答
展开全部
定时执行存储过程,需要在job里定义;而执行多个存储过程,则在job中定义多次即可。
运行环境:oracle 10g
1、定义其中一个job
1
2
3
4
5
6
7
8
9
10
11
12
13
declare
jobno number;
begin
dbms_job.submit(11,
what => 'pro_bdc_bh(
to_char(add_months(trunc(sysdate),-1),''yyyy''),
to_char(add_months(trunc(sysdate),-1),''MM''),
''true''
);',
next_date => sysdate,
Interval => 'TRUNC(sysdate) + 1 +2 / (24)');
commit;
end;
注意:其中pro_bdc_bh为存储过程名称,TRUNC(sysdate) + 1 +2 / (24)为定义的运行时间为每日凌晨2点。
2、然后定义另外一个job
1
2
3
4
5
6
7
8
9
10
11
12
13
declare
jobno number;
begin
dbms_job.submit(11,
what => 'p_test(
to_char(add_months(trunc(sysdate),-1),''yyyy''),
to_char(add_months(trunc(sysdate),-1),''MM''),
''true''
);',
next_date => sysdate,
运行环境:oracle 10g
1、定义其中一个job
1
2
3
4
5
6
7
8
9
10
11
12
13
declare
jobno number;
begin
dbms_job.submit(11,
what => 'pro_bdc_bh(
to_char(add_months(trunc(sysdate),-1),''yyyy''),
to_char(add_months(trunc(sysdate),-1),''MM''),
''true''
);',
next_date => sysdate,
Interval => 'TRUNC(sysdate) + 1 +2 / (24)');
commit;
end;
注意:其中pro_bdc_bh为存储过程名称,TRUNC(sysdate) + 1 +2 / (24)为定义的运行时间为每日凌晨2点。
2、然后定义另外一个job
1
2
3
4
5
6
7
8
9
10
11
12
13
declare
jobno number;
begin
dbms_job.submit(11,
what => 'p_test(
to_char(add_months(trunc(sysdate),-1),''yyyy''),
to_char(add_months(trunc(sysdate),-1),''MM''),
''true''
);',
next_date => sysdate,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询