Skip to main content
Solved

Scheduled Database Task between certain times


PRODQ
Superhero (Customer)
Forum|alt.badge.img+17
  • Superhero (Customer)
  • 469 replies

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.

Best answer by anmise

PRODQ wrote:
anmise wrote:

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? 

View original
Did this topic help you find an answer to your question?

18 replies

CallumW
Superhero (Partner)
Forum|alt.badge.img+15
  • Superhero (Partner)
  • 128 replies
  • January 17, 2020

Try this:

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

 


PRODQ
Superhero (Customer)
Forum|alt.badge.img+17
  • Author
  • Superhero (Customer)
  • 469 replies
  • January 17, 2020

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


CallumW
Superhero (Partner)
Forum|alt.badge.img+15
  • Superhero (Partner)
  • 128 replies
  • January 17, 2020

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! 


  • Superhero (Employee)
  • 1432 replies
  • January 19, 2020

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;

PRODQ
Superhero (Customer)
Forum|alt.badge.img+17
  • Author
  • Superhero (Customer)
  • 469 replies
  • January 20, 2020
anmise wrote:

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 ...


PRODQ
Superhero (Customer)
Forum|alt.badge.img+17
  • Author
  • Superhero (Customer)
  • 469 replies
  • January 20, 2020
CallumW wrote:

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 


  • Superhero (Employee)
  • 1432 replies
  • Answer
  • January 20, 2020
PRODQ wrote:
anmise wrote:

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? 


CallumW
Superhero (Partner)
Forum|alt.badge.img+15
  • Superhero (Partner)
  • 128 replies
  • January 20, 2020

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

anmise wrote:

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;

 


PRODQ
Superhero (Customer)
Forum|alt.badge.img+17
  • Author
  • Superhero (Customer)
  • 469 replies
  • January 21, 2020

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


  • Superhero (Employee)
  • 1432 replies
  • January 21, 2020
PRODQ wrote:

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!


Forum|alt.badge.img+10
  • Sidekick (Customer)
  • 105 replies
  • December 10, 2020
anmise wrote:
PRODQ wrote:
anmise wrote:

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.

 


Forum|alt.badge.img+10
  • Sidekick (Customer)
  • 105 replies
  • December 11, 2020

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


CallumW
Superhero (Partner)
Forum|alt.badge.img+15
  • Superhero (Partner)
  • 128 replies
  • December 11, 2020

@KHALIDU

Try:

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

Every hour - on the hour Monday to Friday


Forum|alt.badge.img+10
  • Sidekick (Customer)
  • 105 replies
  • December 11, 2020

@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. 


CallumW
Superhero (Partner)
Forum|alt.badge.img+15
  • Superhero (Partner)
  • 128 replies
  • December 11, 2020

What version of Oracle are you using for apps 8?


Forum|alt.badge.img+10
  • Sidekick (Customer)
  • 105 replies
  • December 11, 2020

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


Forum|alt.badge.img+7
  • Sidekick (Partner)
  • 13 replies
  • February 17, 2021

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


eqbstal
Superhero (Partner)
Forum|alt.badge.img+21
  • Superhero (Partner)
  • 677 replies
  • October 2, 2023

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings