Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Mutating table

Mutating table

From: <bagnonm_at_I_should_put_my_domain_in_etc_NNTP_INEWS_DOMAIN>
Date: 1998/03/10
Message-ID: <6e3k1j$ffn@polaris.inta.es>#1/1

Suppose you have a master-detail schema. Let the master be

TABLE bill

   billid NUMBER
   ...
   billtotal NUMBER
   PRIMARY KEY billid

The detail table holds the bill lines, something like

TABLE billline

   billid		NUMBER
   billlineid		NUMBER
   billarticle 		NUMBER
   billlinetotal	NUMBER 

   PRIMARY KEY billlineid
   FOREIGN KEY billarticle REFERENCES articles(artid)    FOREIGN KEY billid REFERENCES bill(billid)

In the master table you want to have the sum of all the <billlinetotal>
fields of the detail lines.

When I set up a trigger on insert of
the detail table, to update the master
field, I get a MUTATING TABLE error.

So, the question is:

How can I update fields of
the master table when inserting
detail table rows?

Thanks.

--

                8^) bagnonm_at_inta.es 8^)

Oh, I am a C programmer and I'm okay
        I muck with indices and structs all day
And when it works, I shout hoo-ray
        Oh, I am a C programmer and I'm okay
Received on Tue Mar 10 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US