How to include time zone and daylight saving settings in scheduler jobs

In case one needs to include time zone and daylight savings infor­mation in a job schedule, it must be supplied in the start_date parameter. The calendar arith­metic will then consider this information.

BEGIN
dbms_scheduler.create_job( 
job_name => 'some_job',
job_type => 'PLSQL_BLOCK',
job_action => 'begin
null;
end;',
repeat_interval => 'freq=hourly; 
bymonthday=1,2,3; 
byhour=12,13,14;',
start_date => trunc(systimestamp) at time zone 'Europe/Berlin',
job_class => '"DEFAULT_JOB_CLASS"',
auto_drop => FALSE,
enabled => TRUE);
END;
/

 

select job_name, NEXT_RUN_DATE from dba_scheduler_jobs 
where JOB_NAME = 'SOME_JOB';
 
JOB_NAME                       NEXT_RUN_DATE                    
------------------------------ ----------------------------------
SOME_JOB                       01.02.16 12:00:00,700000000 EUROPE 
                               /BERLIN

 

Make sure you have the latest DST patches in place.

 

Kommentar verfassen

Entdecke mehr von Lutz Haake | Freelance Oracle Consultant

Jetzt abonnieren, um weiterzulesen und auf das gesamte Archiv zuzugreifen.

Weiterlesen