Home » RDBMS Server » Server Administration » trigger doesn't fire with Merge Statement
trigger doesn't fire with Merge Statement [message #60812] Mon, 08 March 2004 13:41 Go to next message
Wayne
Messages: 2
Registered: March 2004
Junior Member
We have a before update trigger (enabled) on a table.  When fired, the trigger will update certain date fields in the core table, and write the :old record to a history table.  The trigger has an exception section to trap errors.

I'm running code that makes use of the MERGE statement.  The merge statement is working, and records are being updated in the database.  However, it appears as though the trigger is not firing 'for every row' as the date fields are not updated and a row is not placed into the history table.  If I update the row manually via sql, the trigger behaves as expected.  Do triggers not fire when using the Merge statement?  Is there an addtional clause I need to use?  I'm on version 9.2.0.4.0

Any help sincerely appreciated.

Thanks.......Wayne
Re: trigger doesn't fire with Merge Statement [message #60826 is a reply to message #60812] Tue, 09 March 2004 04:14 Go to previous messageGo to next message
Frank Naude
Messages: 4580
Registered: April 1998
Senior Member
Hi,

Found the following in the SQL Reference Guide:

"MERGE... If the update clause is executed, then all update triggers defined on the target table are activated."

If your trigger behave differently, you might want to raise a TAR with Oracle Support.

Best regards.

Frank
Re: trigger doesn't fire with Merge Statement [message #61912 is a reply to message #60812] Wed, 09 June 2004 15:37 Go to previous messageGo to next message
Eric Sorrin
Messages: 2
Registered: June 2004
Junior Member
Wayne,

I'm having the same problem on my 9.2.0.1.0 production database but it
seems to work fine on my 9.2.0.5.0 test database. Have you resolved
this yet? Please let me know if going to 9.2.0.5.0
helps.
Re: trigger doesn't fire with Merge Statement [message #61925 is a reply to message #61912] Thu, 10 June 2004 06:31 Go to previous messageGo to next message
Wayne
Messages: 2
Registered: March 2004
Junior Member
I did not resolve the problem.
Tried several things, and verified that the trigger
worked fine without the merge statement.
We needed to complete a project asap so I just rewrote
the code and got rid of the merge statement.

Thanks for the info about it working correctly in the
9.2.0.5.0 environment.

good luck Eric
Re: trigger doesn't fire with Merge Statement [message #61927 is a reply to message #61925] Thu, 10 June 2004 11:35 Go to previous message
Eric Sorrin
Messages: 2
Registered: June 2004
Junior Member
Wayne and for anyone else that might want to use merge in the future,

I found the documented bug. It is bug 3041411 - triggers don't fire properly when using when clause with :new. It is fixed in 9.2.0.5.
Previous Topic: Materialized View
Next Topic: server
Goto Forum:
  


Current Time: Fri Sep 20 14:29:54 CDT 2024