plsql - oracle dbms_scheduler repeat_interval -


I have a process named MY_PROCEDURE_X in a packaged MY_PACKAGE_X. My requirement is that there is a need to execute on the first and the 16th of every month. If it is running on the first part of the month, the execution time should be at 10:00, if it is going on the 16th day of the month, the execution time should be at 05:00.

Can I do a single job for both of these? Below is my half-script:

  dbms_scheduler.create_job start (job_name = & gt; 'PROCESS_MY_JOB_X', JOB_TYPE = & gt; 'PLSQL_BLOCK', JOB_ACTION = & gt; 'MY_PACKAGE_X.MY_PROCEDURE_X ', START_DATE = & gt; TO_DATE ('01 -11-2014 10:00', 'DD-MM-YYYY HH24: MI'), REPEAT_INTERVAL = & gt; 'freq = day; INTERVAL = 14', enable = Gt; correct, comment = & gt; leave 1 and 16th of each month '); End;  

Thanks in advance ;)

< when P> edit: in my previous answer did not really work BYHOUR could not be used in time decide for some reason - it gave an error

instead, I have a single REPEAT_INTERVAL expression for ways to do this.

  'freq = monthly; BYMONTHDAY = 1,16; BYHOUR = 10,17; BYSETPOS = 1,4 ' 

The trick here is that BYMONTHDAY = 1,16 and BYHOUR = 10,17 actually makes four a set date / time : <10 p>

1 to 10, 1 to 17, 10, 16 16 17

then BYSETPOS = 1,4, is one of the sets of four and 4 picks the date / time , And we want two dates / times.

No one can always test REPEAT_INTERVAL dbms_scheduler.evaluate_calendar_string expression using like for example:

 < Code> StartDate announcement date; Date after date; Next date; Start Getting Started: = TO_DATE ('01 -11-2014 10:00 ',' DD-MM-YYYYHH 24: MI '); Date: = StartDate; For I 1..24 loop in dbms_scheduler.evaluate_calendar_string ('freq = monthly; BYMONTHDAY = 1,16; BYHOUR = 10,17; BYSETPOS = 1,4', StartDate, dateafter, NEXTDATE); Dbms_output.put_line (to_char (next date, 'YYYY-MM-DD HH24: MI')); Date: = Next date; End loop; End; /  

This block outputs this result:

  2014-11-16 17:00 2014-12-01 10:00 2014-12 -16 17: 00 2015-01-01 10:00 2015-01-16 17:00 2015-02-01 10:00 2015-02-16 17:00 2015-03-01 10:00 2015-03-16 17:00 2015-04-01 10:00 2015-04-16 17:00 2015-05-01 10:00 2015-05-16 17:00 2015-06-01 10:00 2015-06-16 17: 00 2015- 07-01 10:00 2015-07-16 17:00 2015-08-01 10:00 2015-08-16 17:00 2015-09-01 10:00 2015-09-16 17:00 2015 -10- 01 10:00 2015-10-16 17:00 2015-11-01 10:00  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -