Home | Previous Page | Next Page   Creating and Using Triggers > How to Create a Trigger >

A Complete CREATE TRIGGER Statement

To define a complete CREATE TRIGGER statement, combine the trigger-name clause, the trigger-event clause, and the triggered-action clause. The following CREATE TRIGGER statement is the result of combining the components of the statement from the preceding examples. This trigger executes the SPL routine upd_items_p1 whenever the quantity column of the items table is updated.

CREATE TRIGGER upqty
UPDATE OF quantity ON items
BEFORE(EXECUTE PROCEDURE upd_items_p1)

If a database object in the trigger definition, such as the SPL routine upd_items_p1 in this example, does not exist when the database server processes the CREATE TRIGGER statement, it returns an error.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]