I have been following Stackoverflow for years but posting for the first time. I am trying to dynamically schedule a script in Toad but there doesn't seem to be an option for it. For example, I want to automatically trigger a script on lets say 2nd Feb, 2020. Then it should run after 4 weeks on 1st March 2020. Then after 5 weeks on 5th April, 2020. Then after 4 weeks on 3rd May, 2020 and so on. Is there a way of achieving this in Toad automation?
TIA
I use TOAD as a GUI to access Oracle database(s). I don't know which database you use. Nonetheless, from my point of view, you should schedule a database job.
In Oracle, you'd use
DBMS_JOB
orDBMS_SCHEDULER
. The latter is capable of running even an operating system script (if that's a "script" you are talking about). Otherwise, usually we schedule a stored procedure (which resides in the database).If, on the other hand, you'd want to run that "script" on the operating system level only, then check your operating system scheduling capabilities. On MS Windows, that would be the Task Scheduler; on UNIX, it is cron.
As intervals you'd want to run that script isn't straightforward (e.g. "on 2nd of every month" or "every 5 weeks" and similar) but "today, 4 weeks later, 5 weeks later, 4 weeks later, 5 weeks later, ...", you'll probably have to develop some logic to do so. For example, create a calendar table and mark days on which you want to run that script, schedule it to run daily but check whether today's data equals the one which is marked. Or, create two jobs: one that starts "today" and runs every 10 weeks, and the one that starts "today + 4 weeks" and runs every 10 weeks.