I have an update statement, nested in an update trigger:
CREATE TRIGGER "BAD_RECURSIVE_TRIGGER"
AFTER UPDATE ON "MYTABLE"
REFERENCING NEW AS NEW_ROW
FOR EACH ROW
WHEN (NEW_ROW.ORDER IS NOT NULL)
BEGIN ATOMIC
IF <SOMECONDITION> THEN
UPDATE "MYTABLE" SET ORDER=ORDER+1 // This "update" fires the recursion.
WHERE <OTHERCONDITION>
END IF;
END;
I want to prevent the recursive execution of the trigger, this is on DB2 (v9.7), I've seen similar questions for SQL-Server and ORACLE databases:
Prevent recursive trigger in PostgreSQL
How do I prevent a database trigger from recursing?
But I can't find a way to prevent this over DB2. Is there a way to prevent a recursive trigger call over DB2?