PDA

View Full Version : Automated Database processes?



dpgtfc
22 Oct 2007, 10:52 AM
I am using MySQL 5 and I was wondering if there are any good PL/SQL options for automated database processes. What I have is one table that holds data for 30 days, and an archive table that holds those older than 30 days. The database is for an auction type of program in which the "auction" ends after 30 days (or until user ends it). I would like auctions that are 30 days old to all be ended at a certain time of the day, every day.

I know very little Perl, but could write a CGI script or something to do it, but thought I would check to see if there are any PL/SQL options that could do the same thing. I would prefer the process to be auto-initiating, as at the certain time of the day no administrator must type in the command. I don't know if you can do this with perl, unless there is a program that runs continuously.

Any ideas?

*I would like the program to simply do a select based on the date -30 days, and delete all the entries that are 30 days old. I will have a trigger that inserts the data from each deletion into the archive table.

247SiteAlert
22 Oct 2007, 04:18 PM
If you're hosted on a Linux box you can do this using a cron job.

I don't program in Perl anymore (I use PHP) but the concert is still the same: code a script to do what you want to the database and put it in a cron job to run when ever you want.

Using Perl or PHP you can automate what ever you want - just write the script and then let cron exceute it for your automatically. You can tell cron exactly when to run your script!