Define the triggered actions

The triggered actions are the SQL statements that are performed when the trigger event occurs. The triggered actions can consist of INSERT, DELETE, UPDATE, EXECUTE FUNCTION and EXECUTE PROCEDURE statements. In addition to specifying what actions are to be performed, however, you must also specify when they are to be performed in relation to the triggering statement. You have the following choices:
  • Before the triggering statement executes
  • After the triggering statement executes
  • For each row that is affected by the triggering statement

A single trigger on a table can define actions for each of these times.

To define a triggered action, specify when it occurs and then provide the SQL statement or statements to execute. You specify when the action is to occur with the keywords BEFORE, AFTER, or FOR EACH ROW. The triggered actions follow, enclosed in parentheses. The following triggered-action definition specifies that the SPL routine upd_items_p1 is to be executed before the triggering statement:
BEFORE(EXECUTE PROCEDURE upd_items_p1) -- a BEFORE action