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 -> Re: mutating table

Re: mutating table

From: Joe & Anne Buhl <jabuhl_at_worldnet.att.net>
Date: 11 Dec 1998 03:35:31 GMT
Message-ID: <3670940E.E220CD7F@worldnet.att.net>


bail out on the triggers. You will have to employ a procedure. Triggers will not let you issue dml statements against the table which the triggers is firing on.

Have the proc delete the old rows at some interval or call it from the logging app aftert your insert it complete that doing the insert or update on the table.

Bottom line. Triggers modify other tables not the table the trigger is firing from.

joe

Zachary Agatstein wrote:

> Hi,
>
> I have a table that is used for periodic logging. The logging application
> inserts a burst (currently 369) of records every minute. This will be
> changed to once in 5 minutes. On the other hand, I need to delete old
> records periodically also.
>
> So, I created an AFTER INSERT ROW trigger on the log table, where I first
> tried to delete a number of old records. As you know, this did not work, as
> the table was declared "mutating", and neither of the two operations
> (inserting new records and deleting old ones) worked.
>
> So, smart ass I am, I created a dummy table, and let the original trigger
> update the dummy, and then created a new trigger, which would fire on update
> of the dummy table and proceed to delete the records from the original log
> table. But Oracle is smart enough to see through this, and complains about
> "mutation" just as well.
>
> What's a good strategy to implement this?
>
> Thanks
>
> Zach Agatstein
Received on Thu Dec 10 1998 - 21:35:31 CST

Original text of this message

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