Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sum of Details on Master
On Fri, 28 Mar 97 10:59:22 GMT, nbroucke_at_be.oracle.com (Nico Vandenbroucke) wrote:
>Any1 who knows how to handle this problem?
>
>The database holds two tables ('INVOICE' (master) and 'INVOICELINE' (detail)).
>Every Invoice line has an amount.
>
>We would like to keep the total amount of the invoice lines in the Invoice
>table.
Why wouldn't you be able to put the following SQL in both the trigger and the Form?
Update user.invoice i set
line_summ =
(select sum(il.line_amt)
from user.invoice_line il
where i.invoice_no = il.invoice_no
and il.invoice_no = :some_parameter)
;
That way, no matter who 'gets' to the invoice row last, the total will be correct. Received on Sat Mar 29 1997 - 00:00:00 CST