delete column data every 30 days [message #376017] |
Mon, 15 December 2008 12:41 |
vijju56
Messages: 22 Registered: December 2008
|
Junior Member |
|
|
Hi,
I got a question for you all. I had a BLOB column in my database. I will insert pdf’s into that BLOB column. If I want to delete the data in that BLOB column for every 30 days, what do I need to do? I am looking for some suggestions.
Thanks
|
|
|
Re: delete column data every 30 days [message #376018 is a reply to message #376017] |
Mon, 15 December 2008 12:47 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
What do you mean "for every 30 days?"
If you want to delete data older than 30 days, then a simple WHERE clause with the correct condition against one of your table columns is what you need.
|
|
|
Re: delete column data every 30 days [message #376019 is a reply to message #376017] |
Mon, 15 December 2008 12:52 |
vijju56
Messages: 22 Registered: December 2008
|
Junior Member |
|
|
Hi,
Thanks for the quick reply. The problem is as we are going to store pdf files in BLOB columns, it will occupy lots of space in the database. So, we are planning to delete the data in the BLOB column for every 30 days. That's what our plan is.
So, I dont know, how to achieve my goal. I am waiting for any suggestions.
I heard that, we can use cron jobs for deleting BLOB column data for every 30 days. Is there anything like that or anything other than that.
|
|
|
|
Re: delete column data every 30 days [message #376023 is a reply to message #376020] |
Mon, 15 December 2008 13:26 |
vijju56
Messages: 22 Registered: December 2008
|
Junior Member |
|
|
I got a table like this:
tmp_pdf
id NUMBER(9,0)
pdf BLOB
Here in our process, user will fill the pdf form online and submit it. we will keep that filled pdf form for 30 days for confirmation details. As our database is small, we want to delete that filled pdf form for every 30 days - to make space for future pdf forms insertion. So, now the question is, how can I delete the data in BLOB column for every 30 days.
Thanks
|
|
|
Re: delete column data every 30 days [message #376027 is a reply to message #376023] |
Mon, 15 December 2008 13:34 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
You still haven't explained what "for every 30 days." means. It makes no sense.
If you want to delete all rows OLDER than 30 days, then add a date field to your table that you set to sysdate when you insert the row, and then just run a delete every day with the appropriate where-clause to delete all rows with an insert date smaller than sysdate - 30 every day.
[Updated on: Mon, 15 December 2008 13:34] Report message to a moderator
|
|
|
|
|
Re: delete column data every 30 days [message #376037 is a reply to message #376027] |
Mon, 15 December 2008 13:58 |
vijju56
Messages: 22 Registered: December 2008
|
Junior Member |
|
|
Hi,
Thanks for the reply. Ok, I kept a date column in my table. And will remove the older pdf files which are older than 30 days of the current date. But, we have do that deletions manually. How can we do it dynamically i.e., Is there anything like:
write our program of deleting 30 days data once, and execute it exactly for every 30 days?
Thanks
|
|
|
|
|
|