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.
Create a trigger using Object Browser.
To create a trigger in Object Browser:
Select a trigger from the Object Selection pane and view different reports about the trigger.
To browse a trigger in Object Browser:
See Also:
Alternative views available when viewing a trigger in Object Browser.
Table 2-10 describes all available reports for triggers.
Table 2-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:
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.
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:
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: