Summary Query in Trigger (Mutating Table)

From: Sohel Mia <mahmud_at_deliver-bd.com>
Date: 8 Dec 2002 23:56:11 -0800
Message-ID: <cbbdb4d5.0212082356.7b199b10_at_posting.google.com>


I have a table PRODUCT_PRICE with fields PRODUCT_ID, PURCHASE_DATE, QUANTITY, UNIT_PRICE. This table will contain historical purchase transactions of each product. After a product is bought, I want to compute the average price of each product and put it in the AVG_PRICE field in master PRODUCTS table. I tried to compute the average in after insert trigger of PRODUCT_PRICE table. But it is showing mutating table error. Is there any way of computing the average automatically each time a product price is inserted, updated or deleted?

Pls help.

We are using:
Oracle 8.1.7
Win 2000 Server Received on Mon Dec 09 2002 - 08:56:11 CET

Original text of this message