Summary

To introduce triggers, this chapter discussed the following topics:
  • The components of the CREATE TRIGGER statement
  • Types of DML statements that can be triggering events
  • Types of SQL statements that can be triggered actions
  • How to create BEFORE and AFTER triggered actions and how to use them to determine the impact of the triggering statement
  • How to create a FOR EACH ROW triggered action and how to use the REFERENCING clause to refer to the values of columns both before and after the action of the triggering statement
  • INSTEAD OF triggers on views, whose triggering event is ignored, but whose triggered actions can modify the base tables of the view
  • The advantages of using SPL routines as triggered actions
  • Special features of calls to trigger routines as triggered actions
  • How to trace triggered actions if they behave unexpectedly
  • How to generate two types of error messages within a triggered action.