Online Documentation for SQL Manager for DB2
Triggers
A Trigger is an object in the database that is invoked indirectly by the database manager when a particular SQL statement is run.
To create a new trigger:
- select the Database | New Object... main menu item;
- select Trigger in the Create New Object dialog;
- edit trigger properties using the appropriate tabs of Trigger Editor.
Hint: To create a new trigger, you can also right-click the Triggers node of the DB Explorer tree and select the New Trigger... context menu item.
To create a new trigger with the same properties as one of existing triggers has:
- select the Database | Duplicate Object... main menu item;
- follow the instructions of Duplicate Object Wizard.
Alternatively, you can right-click a trigger in the DB Explorer tree and select the Duplicate Trigger <trigger_name>... context menu item.
Duplicate Object Wizard allows you to select the database to create a new trigger in, and to edit the result SQL statement for creating the trigger.
To edit an existing trigger:
- select the trigger for editing in the DB Explorer tree (type the first letters of the trigger name for quick search);
- right-click the object and select the Edit Trigger <trigger_name>... context menu item, or simply double-click the trigger;
- edit trigger definition using the appropriate tabs of Trigger Editor.
To drop a trigger:
- select the trigger to drop in the DB Explorer tree;
- right-click the object and select the Drop Trigger <trigger_name>... context menu item;
- confirm dropping in the dialog window.
Note: If more convenient, you can also use the following shortcuts:
Ctrl+N to create a new trigger;
Ctrl+O to edit the selected trigger;
Shift+Del to drop the object from the database.