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.

 

 

Creating Triggers

 

To create a new trigger:

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:

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.

 

 

Editing Triggers

 

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.

 

Dropping Triggers

 

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.