Re: Is there a workaround for the 'mutating table' problem in a trigger ?

From: Vinayak Kulkarni <vinayak_at_ix.netcom.com>
Date: 1996/04/15
Message-ID: <4kunnm$9u8_at_dfw-ixnews6.ix.netcom.com>#1/1


In <31726A87.353D_at_theta.co.nz> Rob Benson <robben_at_theta.co.nz> writes:
>
>coolcat_at_citynet.net wrote:
>>
>> Hi
>>
>> In a trigger on a table, I want to do a
>> SELECT MAX() ...
>> from that table and update a denormalized column in another table.
>> .....
>> TIA.
>
>In earlier releases (7.1.3 back I think) you could get around this
>by selecting from a view based on the table concerned BUT I notice
>in 7.1.6 that this no longer works. Will get back to you if I
>think of a work around.
>
>--
>**************************
>Rob Benson
>Theta Systems Limited
>robben_at_theta.co.nz
>http://theta.co.nz/theta
>

TWO SOLUTIONS :

  1. Write a package and store all the modifications to be done in global variables in the package, then write an after statement trigger to do the actual updates.
  2. Use dynamic SQL to disable and enable integrity constraint before and after the update.

I have Solution #1 implemented and running in production. I never had time to try #2, I guess that should work too. Received on Mon Apr 15 1996 - 00:00:00 CEST

Original text of this message