3.11 Managing Triggers
A database trigger is a stored subprogram associated with a database table, view, or event. You can create, browse, edit, compile, download, drop, disable or enable a trigger and view report.
The trigger can be called once, for example when an event occurs, or many times, for example for each row affected by an INSERT, UPDATE, or DELETE statement.
- Creating Triggers
Create a trigger using Object Browser. - Browsing a Trigger
Select a trigger from the Object Selection pane and view different reports about the trigger. - Reports for Triggers
Alternative views available when viewing a trigger in Object Browser. - Editing a Trigger Manually
Select a trigger from the Object Selection pane and click Code. - Compiling a Trigger
Select a trigger from the Object Selection pane and click Save & Compile. - Downloading a Trigger
Select a trigger from the Object Selection pane and click Download Source to save the current trigger as a file. - Dropping a Trigger
Select a trigger from the Object Selection pane and click Drop. - Disabling and Enabling a Trigger
Select a trigger from the Object Selection pane and click Disable or Enable.
Parent topic: Managing Database Objects with Object Browser
3.11.1 Creating Triggers
Create a trigger using Object Browser.
To create a trigger in Object Browser:
Parent topic: Managing Triggers
3.11.2 Browsing a Trigger
Select a trigger from the Object Selection pane and view different reports about the trigger.
To browse a trigger in Object Browser:
See Also:
Parent topic: Managing Triggers
3.11.3 Reports for Triggers
Alternative views available when viewing a trigger in Object Browser.
Table 3-10 describes all available reports for triggers.
Table 3-10 Available Reports for Triggers
View | Description |
---|---|
Object Details |
(Default) Lists of the details about the current trigger. Actions you can perform include:
|
Code |
Displays the source code for the trigger. You can edit the code in this view. Actions you can perform in this view include:
|
Errors |
Displays errors related to the current trigger. |
SQL |
Displays the SQL necessary to re-create the trigger. |
See Also:
Parent topic: Managing Triggers
3.11.4 Editing a Trigger Manually
Select a trigger from the Object Selection pane and click Code.
When you edit a trigger you can edit the code manually, perform a search and replace, and compile the trigger.
Parent topic: Managing Triggers
3.11.5 Compiling a Trigger
Select a trigger from the Object Selection pane and click Save & Compile.
If you edit and make changes to a function, you must compile to save your changes. There is no save function because this is just a view of the object within the database. Compiling re-creates the object in the database.
To compile a trigger in Object Browser:
Parent topic: Managing Triggers
3.11.6 Downloading a Trigger
Select a trigger from the Object Selection pane and click Download Source to save the current trigger as a file.
To save the current trigger as a file:
Parent topic: Managing Triggers
3.11.7 Dropping a Trigger
Select a trigger from the Object Selection pane and click Drop.
To drop a trigger in Object Browser:
Parent topic: Managing Triggers
3.11.8 Disabling and Enabling a Trigger
Select a trigger from the Object Selection pane and click Disable or Enable.
To disable and enable a trigger in Object Browser:
Parent topic: Managing Triggers