Subject | how to delayed update in trigger |
---|---|
Author | svanderclock |
Post date | 2009-12-23T11:28:18Z |
hello,
we have 2 tables
invoice
items
in invoice we have a field Amount. we update this field by the help of a triger, everytime an items is add, delete or updated.
the problem is that, if i create an invoice with 10 items, i will 10 times update the field amount in the invoice ! this what i don't want, i want to update the invoice amount only at the end when all the items are inserted.
so is it possible to "delayed the update of the amount" to not update it for every insert ?
for exemple a trigger "before commit" will be a perfect solution for me (with the help of temp table)
or any other suggestion ?
thanks you by advance
stephane
we have 2 tables
invoice
items
in invoice we have a field Amount. we update this field by the help of a triger, everytime an items is add, delete or updated.
the problem is that, if i create an invoice with 10 items, i will 10 times update the field amount in the invoice ! this what i don't want, i want to update the invoice amount only at the end when all the items are inserted.
so is it possible to "delayed the update of the amount" to not update it for every insert ?
for exemple a trigger "before commit" will be a perfect solution for me (with the help of temp table)
or any other suggestion ?
thanks you by advance
stephane