A database trigger is a procedure that is automatically executed in response to certain events on a database table. A common use of database trigger is for auditing database. A trigger that records the insertion, modification and deletion of important data will let you know when and why certain change has been made to the database.
Creating a Trigger
- Select Triggers from diagram toolbar.
- Click on the ERD to create a triggers shape. Note again that this is a container of triggers, not the trigger itself.
- Enter its name.
- To create a trigger, right click on the triggers shape and select New Trigger from the popup menu.
- Enter the physical name of the trigger.
- Right click on the trigger and select Open Specification… from the popup menu.
- Enter the Create statement of trigger. The create statement entered here will be executed in database generation, so make sure it’s in correct syntax.
Moving or duplicating a trigger to another trigger container
- Select the trigger to move or duplicate.
- Drag over the target trigger container.
- If you want to duplicate the triggers, press on the Ctrl key and release the mouse button. If you want to move them from source to target trigger container, just release the mouse button.