Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: time shift in sheduled job
James wrote:
>
> I need to run the scheduled job every two hours. So far so good. But I
> notice that there is a problem because the next_date has been shifting from
> the sharp o'clock after a few runs. For example, if I start the job at 12:00
> noon, the next job will be running at about 2:01, the next one may be 4:02.
> I can see that this will become serious after a few months. I can re-submit
> the job after a few days. But is there any better way to reset the next_date
> to sharp o'clock? Thanks in advance for any clue.
>
> Here is the script:
>
> BEGIN
> DBMS_JOB.ISUBMIT
> (1,'MY_PROC;',TRUNC(SYSDATE)+12/24,'SYSDATE+1/12',NULL);
> COMMIT;
> END;
"Next" is calculated at the end - all you need do is use TRUNC to remove
the minutes that may have passed
ie
TRUNC(sysdate+1/12,'HH')
HTH
-- =========================================== Connor McDonald http://www.oracledba.co.uk (mirrored at http://www.oradba.freeserve.co.uk) "Early to bed and early to rise, makes a man healthy, wealthy and wise." - some dead guyReceived on Wed Nov 01 2000 - 04:53:30 CST