Automatic update table based on time
-
Suppose some one purchased a ticket online. [Here the value of a column is pending] If the person does not pay the cash money within 24 hours than the ticket will be automatically cancelled. [The value of the status column will be cancelled after 24 hours] So, How can I do automatic update of a table after 24 hours???
-
Suppose some one purchased a ticket online. [Here the value of a column is pending] If the person does not pay the cash money within 24 hours than the ticket will be automatically cancelled. [The value of the status column will be cancelled after 24 hours] So, How can I do automatic update of a table after 24 hours???
Easiest way would be to run a job[^] at a specified interval that checks the table and does whatever it needs to do.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
-
Suppose some one purchased a ticket online. [Here the value of a column is pending] If the person does not pay the cash money within 24 hours than the ticket will be automatically cancelled. [The value of the status column will be cancelled after 24 hours] So, How can I do automatic update of a table after 24 hours???
AhmedMasum wrote:
Suppose some one purchased a ticket online. [Here the value of a column is pending] If the person does not pay the cash money within 24 hours than the ticket will be automatically cancelled. [The value of the status column will be cancelled after 24 hours]
It's not pending, it's reserved from that moment forward. Otherwise you could run into the problem that there's more pending than there's actually available.
AhmedMasum wrote:
How can I do automatic update of a table after 24 hours???
I'd run through it once an hour, processing the valid payments (sending out a ticket to an address) and the invalid ones.
I are Troll :suss:
-
Suppose some one purchased a ticket online. [Here the value of a column is pending] If the person does not pay the cash money within 24 hours than the ticket will be automatically cancelled. [The value of the status column will be cancelled after 24 hours] So, How can I do automatic update of a table after 24 hours???
I wouldn't; I'd design the system so that that isn't required. The Pending column should be a date column that is set to the time when it will expire if not Purchased. Then, when seeking available tickets, look for any where the Pending field is null or less than the current time and Purchased (another date field) is also null. Or name them Ordered and Purchased or something, but I wouldn't put them in a single Status column, Status could be calculated from a number of fields, including Shipped.
-
I wouldn't; I'd design the system so that that isn't required. The Pending column should be a date column that is set to the time when it will expire if not Purchased. Then, when seeking available tickets, look for any where the Pending field is null or less than the current time and Purchased (another date field) is also null. Or name them Ordered and Purchased or something, but I wouldn't put them in a single Status column, Status could be calculated from a number of fields, including Shipped.
Thanks for your nice suggestion!!!. My above case is just an example. Actually I need something that will do insert/update/delete on a table every week or after a specific period of time. Is there any type of trigger can do this type of operation??
-
Easiest way would be to run a job[^] at a specified interval that checks the table and does whatever it needs to do.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
You have done this using sql server. But How can I do this for oracle??
-
Thanks for your nice suggestion!!!. My above case is just an example. Actually I need something that will do insert/update/delete on a table every week or after a specific period of time. Is there any type of trigger can do this type of operation??
Use a Windows Service (for very frequent actions) or a Windows Scheduled Task (for less-frequent actions).