Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Define a job to run once an year
On 24 Dec 2004 05:37:10 -0800, "Rauf Sarwar" <rs_arwar_at_hotmail.com>
wrote:
>
>Robert Scheer wrote:
>> Hi.
>>
>> I need to run a job once an year, more exactly on the last day of the
>> year at 23:59. This job needs to drop a sequence and recreates it.
>How
>> can I configure the job to run at this exact moment in time?
>>
>> Thanks,
>> Robert Scheer
>
>set serverout on
>declare
>job_ integer;
>begin
>dbms_job.submit(job_,
>'your_proc(''parameters'');',
>trunc(to_date('12/31'||to_char(sysdate, 'YYYY'),
>'MM/DD/YYYY')) + 1439/1440,
>'trunc(to_date(''12/31'' || to_char(sysdate + 1,
>''YYYY''), ''MM/DD/YYYY'')) + 1439/1440');
>commit;
> dbms_output.put_line(to_char(job_));
>end;
>/
>
>Regards
>/Rauf
Why not resolve this using LAST_DAY and ADD_MONTHS, so the O/P learns something from it, and can address it on his own next year. Anyway, if it is really a once per year job, one wonders why he didn't use 2004 to resolve it.
-- Sybrand Bakker, Senior Oracle DBAReceived on Fri Dec 24 2004 - 11:14:31 CST