使用DBMS_JOB在Oracle中创建作业 [英] Creating a Job in Oracle using DBMS_JOB

查看:282
本文介绍了使用DBMS_JOB在Oracle中创建作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个作业,该作业将在每个圣诞节执行特定的程序.这是我所走的距离:

I'm trying to create a job that will run a certain procedure every Christmas. This is how far I have gotten:

declare
   jobno number;
begin
   dbms_job.submit( jobno,
                   'BEGIN GiveCoins; END;',
                    to_date('12/25', 'MM/DD'),
                    'sysdate + ?');
end;
/

但是我似乎找不到一种简单的方法来将时间间隔更改为每年",并且总体上对如何解决这个问题感到非常困惑,任何帮助都将不胜感激

However I can't seem to find an easy way to change the interval to yearly and am just generally quite confused about how to go about this, any help greatly appreciated

推荐答案

您想要类似的东西

declare
   jobno number;
begin
   dbms_job.submit( jobno,
                   'BEGIN GiveCoins; END;',
                    to_date('12/25/2012', 'MM/DD/YYYY'),
                    'add_months(trunc(sysdate),12)');
end;
/

这将在2012年圣诞节的午夜首次运行该工作,此后每12个月运行一次.

This will run the job for the first time at midnight on Christmas 2012 and every 12 months after that.

这篇关于使用DBMS_JOB在Oracle中创建作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆