Skip to main content

Does anyone know if it’s possible to schedule a Task between particular times?  I’m looking to scheduled a task daily to run every two minutes but only between 6am and 8pm each day.  

 

 

Any PL/SQL assistance would be appreciated.  

Many thanks.

Try this:

decode(sign(sysdate - (trunc(sysdate) + 20/24)), 1, (trunc(sysdate) + 6/24), (sysdate + 2/1440))

 


Well it didn’t growl at me for wrong syntax.  I’ll let you know after 8pm today if it works!  

 

Many thanks, @CallumW - appreciate the swift response

 

Linda


Check after 08:02pm instead - as depending on when the penultimate task was executed in the queue, it could execute the last task slightly after 8pm! 


I find the DMBS Scheduler syntax is easier to read e.g. 

FREQ=MINUTELY; BYHOUR=6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;INTERVAL=2;

I find the DMBS Scheduler syntax is easier to read e.g. 

 FREQ=MINUTELY; BYHOUR=6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;INTERVAL=2;

Not sure what you mean by this, @anmise ...


Check after 08:02pm instead - as depending on when the penultimate task was executed in the queue, it could execute the last task slightly after 8pm! 

Sadly, this didn’t work, @CallumW 


I find the DMBS Scheduler syntax is easier to read e.g. 

 FREQ=MINUTELY; BYHOUR=6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;INTERVAL=2;

Not sure what you mean by this, @anmise ...

It’s a different format you can put into the ‘Custom Expression’ field. It will run every 2 minutes between 6am and 8pm (20). 

FREQ: How often? 

INTERVAL: Related to FREQ, minutely = 2 e.g. every 2 minutes

BYHOUR: which hours of the day? 


Just to fix my code…

decode(sign(sysdate - (trunc(sysdate) + 6/24)), 1, decode(sign(sysdate - (trunc(sysdate) + 20/24)), -1, (sysdate + 2/1440), (trunc(sysdate+1) + 6/24)), (trunc(sysdate) + 6/24))

--If the time is greater than 06:00 then
--If the time is less than 20:00 then
--2 minute interval
--else set start time to 06:00 the following day
--else set start time to 06:00

 

But I prefer the answer from @anmise as it is A LOT easier to read

I find the DMBS Scheduler syntax is easier to read e.g. 

 FREQ=MINUTELY; BYHOUR=6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;INTERVAL=2;

 


I’m happy to report, @CallumW and @anmise, both solutions worked. 

I now have the moral quandary of which of your responses to mark as Best Answer.  As I think we agree @anmise‘s is the easier to read I’ll plump for that one, @CallumW.

 

Many thanks both, appreciate your input

Linda


I’m happy to report, @CallumW and @anmise, both solutions worked. 

I now have the moral quandary of which of your responses to mark as Best Answer.  As I think we agree @anmise‘s is the easier to read I’ll plump for that one, @CallumW.

 

Many thanks both, appreciate your input

Linda

No worries, the most important thing is that you found a solution!


I find the DMBS Scheduler syntax is easier to read e.g. 

 FREQ=MINUTELY; BYHOUR=6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;INTERVAL=2;

Not sure what you mean by this, @anmise ...

It’s a different format you can put into the ‘Custom Expression’ field. It will run every 2 minutes between 6am and 8pm (20). 

FREQ: How often? 

INTERVAL: Related to FREQ, minutely = 2 e.g. every 2 minutes

BYHOUR: which hours of the day? 

 

IFS8: I tried this syntax AS IS and i am getting syntax error… what could have gone wrong here… 

Once this error will resolve i will fix it hourly for only weekdays hopefully easily.

 


@anmise , @CallumW , @PRODQ  can you assist what is going wrong in my case.


@KHALIDU

Try:

FREQ=HOURLY;BYDAY=MON,TUE,WED,THU,FRI;BYMINUTE=0;BYSECOND=0;INTERVAL=1;

Every hour - on the hour Monday to Friday


@CallumW thanks, still not working in IFS8, however working in IFS10 (we are in process of upgrade). not sure why our PROD env doesn’t like it. 


What version of Oracle are you using for apps 8?


Aaah
 @CallumW  Oracle 12c in IFS8 vs Oracle 19c in IFS10.


I wanted similar thing for generating event based pm work orders for irregular intervals in Apps 10

Scenario:

  1. Work Order required on every 2nd tuesday of month. No idea whether 2nd tuesday of every month was a  luckly day :rofl: but below is the solution i am using in Apps 10

 

 

As per IFS Documentation, below is advised -

 

Hello google :heart_eyes: -

 

Link - https://docs.oracle.com/cd/E11882_01/server.112/e25494/scheduse.htm#ADMIN034

Here you can find lot expressions of use. 

 

Cheers

Regards,

Srinivas


Thanks everyone for including their thoughts over here. It helped me out trying to get a scheduled task to run every last Saturday of a month at 10:30 am. This is the setting I've used:

FREQ=MONTHLY; BYDAY=SAT; BYSETPOS=-1; BYHOUR=10; BYMINUTE=30;

 


Reply