Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Location
    austin,tx
    Posts
    104

    Unanswered: insert stmt in BEFORE UPDATE trigger, supported? SQLSTATE: 42987

    I'm trying to trace through a sequence of triggers to see what is happening and thought I would insert into a table when each trigger fired so I could capture the sequence of events. I am getting an error when I try to add an insert stmt to a particular trigger though. It works in an AFTER trigger, but not in a BEFORE trigger. I get a SQLSTATE: 42987 The trigger "<triggername>" is defined with an unsupported triggered SQL statement.

    Can you not perform an insert into an unrelated table in a BEFORE UPDATE trigger, or is there maybe something else going on?

    This is on Windows machine running DB2 PE 8.1 fp 9.

    Thanks.

  2. #2
    Join Date
    Dec 2005
    Posts
    273
    you cannot modify data with an BEFORE trigger.
    That means: no INSERT, UPDATE, or DELETE-statement, not even a call to a stored procedure that modifies SQL data.

  3. #3
    Join Date
    Aug 2004
    Posts
    330
    Note that the although the insert happens after the triggering action, it is performed in the same unit of work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •