Reputation: 30568
I want to ask about scheduling, is there any MySQL command for scheduling. For example, I want to insert a data into the DB. Can I write a sql statement to hold it for some time, or maybe I insert this data in some scheduled time, for example, tomorrow 8:00 a.m.
I know these can be done by programming, but I want to do it in SQL command, is it possible to do so? If not, any suggestions?
Upvotes: 0
Views: 1149
Reputation: 146199
Scheduling background jobs is not part of the SQL command set. So it is down to each database vendor to provide their own extension. In Oracle it is a PL/SQL package, DBMS_SCHEDULER
(or DBMS_JOB
in older versions). In MYSQL it would appear to be the Event Scheduler, which use SQL syntax.
Edit
As Paul Dixon has pointed out the Event Scheduler is a relatively recent extension to MySQL (I'm not a MySQL expert, so forgive if this is not helpful to you).
Upvotes: 3
Reputation: 300825
MySQL 5.1.6+ has an Event Scheduler.
If you're using an earlier version, you could write a little script which executed the desired SQL, and schedule it with at,cron or similar.
Upvotes: 2
Reputation: 46965
You may want to look at triggers.
Without more detail about exactly what you're trying to do this is a good place to start.
Upvotes: 0