0

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

champ7289
  • 3
  • 1
  • What have you tried? What do you have? What are your _exact_ issues with what you _have_. SO is not a code generation service. – Joshua Jan 04 '21 at 05:31

1 Answers1

0

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

Littlefoot
  • 131,892
  • 15
  • 35
  • 57
  • Hi. Thanks for your reply. I am using Toad to access Microsoft SQL Server database. Also, can you please give some more info on how to schedule TOAD scripts on MS operating system. I am sorry if this is a stupid question. I am new to all this – champ7289 Jan 04 '21 at 13:18
  • I don't use MS SQL Server and I don't know its scheduling capabilities. As of MS Windows, as I said - it is Task Scheduler you'd use. On the other hand, I don't use "TOAD scripts" so I can't tell how to schedule them. What are they? – Littlefoot Jan 04 '21 at 13:24