Creating a trigger

When you create a trigger, you specify the table affected and the command (insert, update, or delete) that activates the trigger. You also specify the action the trigger is to take.

Privileges

Only a table owner or database owner can create a trigger.

StepsCreating a trigger

  1. In the table, select the Triggers folder.

  2. Select File | New | Trigger. The Trigger Creation wizard opens.

    The Trigger Creation wizard asks for the following information:

    Table 21-1: Inputs to the Trigger Creation wizard

    Input

    Description

    Name

    Name for the new trigger.

    Owner

    Specify the user who owns the trigger.

    Event

    Specify the events that can fire the trigger: Insert, Delete, Update, Update of a column.

    Code

    Enter the code for the trigger in the editor. This text can consist of any valid SQL statements that would follow the as keyword in a create trigger statement.

NoteA trigger can also be created using the Add Trigger template. Double-click the Triggers icon of the table you want to add a trigger to. Select Add Trigger (Template).

Shortcut

Select the Triggers folder. In the right pane, double-click the Add Trigger icon.