Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: way to delete records after a period of time if they meet criteria?
kaeli wrote:
> Hey all,
>
> I know I could do this with a cron and a script, but I'm looking into if
> it can be done easily right from Oracle.
> I'm using Oracle 8i on a Unix Solaris box.
>
> Simplified:
> I have a table with records for name, item purchased, date entered, and
> date paid. I want to delete the record if the item hasn't been paid for
> in 5 days after entry.
>
> So...
> delete from tablename where datePaid is null and dateEntered < sysdate-5
>
> Can I do that without a cron that runs once daily?
>
> TIA
This should properly be done with a stored procedure executed by DBMS_JOB.
http://www.psoug.org/reference/library.html
and search for DBMS_JOB.
Daniel Morgan Received on Thu Jul 08 2004 - 19:55:20 CDT