Subject RE: [firebird-support] Re: Help with a trigger/procedure
Author Alan McDonald
> Hi guys,
>
> Sorry for taking this thread out of the grave, but i have another doubt
> about the same thing.
>
> One of the ideas that poped up in this thread was to make a table for the
> batch numbers and just insert values there, and write a procedure to clean
> up this table once in a while (sum all the rows with the same
> batch number,
> create just one with the total and after that delete all the old records).
>
> After dirting my hands with code and hitting the head against the wall
> severel times, now i think this would be the best way to do it.
>
> But still i have a doubt.
>
> Lets imagine that my table is filled with data, and i run the procedure to
> sum the records of the same batch number and after that create
> just one row
> with the total qualtity and then delete all the other records.
>
> Wich would be the best way to do it? what if more users are using
> this table
> when i m running this procedure? how can i prevent my data for being
> inaccurrate?
>
> Could you guys help me out with this?
>
> Thanx in advance.

definitely a job to be done by SYSDBA once the database has been shutdown.
It's a maintenance task. Not to be run while tables edits and inserts are
being carried out. If you want absolutely no chance of someone getting in
your way. Stop the server, rename the db file, do you maintenance, then
shutdown the server and rename back the file before starting the server
again.
Alan