I am creating a database for an auction in which I have a table that stores the entries of Items that are put up for auction.
create table items(
item_ID number(5) PRIMARY KEY,
SDate DATE NOT NULL,
EDate DATE NOT NULL, //end date for auction
minBid number(5,2) NOT NULL,
bidInc number(2,2) NOT NULL,
title varchar2(20) NOT NULL,
descr varchar2(255),
currentBid number(5,2)
)
Now after the end date has passed I want the database to automatically delete that entry from the table.
How do I do it?
Well, you could write a job in the Database what will delete rows older than X time, but since you tagged this as C# I’m guessing you want it done in your auction application.
In that case, you could create a
Timerthat will run aDELETE FROM items WHERE EDate > XXXquery every time it runs.EDIT: In that case, you can define a Stored Procedure that will delete old rows, and then you’ll need to schedule it with a
DBMS_JOB. I don’t have an Oracle DB at hand to test this, but you could try running this:Create a stored procedure:
Then you need to create a job that will execute this stored procedure every X time.