Using Oracle Sql Express 11g, Is There A Way To Create A Way To Reset A Column In A Table To Zero Monthly?

I figured I could do this in Constraints, but I don’t think it work. I’m working on a database that shows the monthly sales of an item and I need it to rest to zero when the month is up. Thanks in advance for any help that could be provided :).

Both comments and pings are currently closed.

One Response to “Using Oracle Sql Express 11g, Is There A Way To Create A Way To Reset A Column In A Table To Zero Monthly?”

  1. Capricor says:

    Hmm. For Oracle 11g Enterprise, my answer would be to use the Oracle Job Scheduler (DBMS_SCHEDULER). I don’t think that Oracle Express has that. Still, you could probably use the OS job scheduler to fire off a bat/cmd file that invokes a SQL script that zeros out the column at the beginning of the month.
    I could also think of a way to do it using a trigger with a before insert or update clause on the column. That would be pretty wasteful of resources though. It would be checked on every insert or update, but only fire once a month. (And you’d need some mechanism to ensure it fires only once.)
    You might be able to set up a database view where the view exposes all the same columns as the table the view is on, but restrict the view to dates between the starting and ending days of the current month. That assumes you have some date in the table you can set the view to use.

Powered by WordPress | Designed by: free css template | Thanks to hostgator coupon and web hosting reviews