Definition and Example

Description

Once a trigger is defined, it is recommended to check whether it is running as intended. Sometimes the trigger takes more time than expected in processing. This means that it is adding too much overhead to the system or has fallen into a recursive loop. This section explains several ways to debug the trigger.

Example

The following example shows a trigger that was defined to fall into a recursive loop when it is called. A loop trigger is somewhat artificial in its purpose; it can be used as an example of debugging trigger.

CREATE TRIGGER loop_tgr

BEFORE UPDATE ON participant(gold)

IF new.gold > 0

EXECUTE UPDATE participant

        SET gold = new.gold - 1

        WHERE nation_code = obj.nation_code AND host_year = obj.host_year;