Oracle® HTML DB
Release 2.0
  Go To Table Of Contents
Contents

Previous
Previous
Next
Next
 

Managing Triggers

A database trigger is a stored subprogram associated with a database table, view, or event. 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.

Topics:


See Also:

Oracle Database Concepts and SQL*Plus User's Guide and Reference for information about triggers

Creating Triggers

To create a trigger:

  1. Navigate to Object Browser:

    1. Click the SQL Workshop icon on the Workspace home page.

    2. Click Object Browser.

      Object Browser appears.

  2. Click Create.

  3. From the list of object types, select Trigger.

  4. Select a table name and click Next.

  5. Select the appropriate trigger attributes, enter the trigger body, and click Next.

    A confirmation page appears. To view the SQL used to create the trigger, click SQL.

  6. Click Finish.

Browsing a Trigger

To browse a trigger in Object Browser:

  1. Navigate to Object Browser:

    1. Click the SQL Workshop icon on the Workspace home page.

    2. Click Object Browser.

      Object Browser appears.

  2. From the Object list, select Triggers.

  3. From the Object Selection pane, select a trigger.

    The Details view appears.

Summary of Available Views

Click the tabs at the top of the page to view different reports about the trigger. Table 18-10 describes all available views.

Table 18-10 Available Views for Triggers

View Description

Object Details

(Default) Lists of the details about the current trigger. Actions you can perform include:

  • Compile

  • Disable

  • Download

  • Drop

  • Code

See Also: "Editing a Trigger", "Compiling a Trigger", "Downloading a Trigger", and "Dropping a Trigger"

Errors

Displays errors related to the current trigger.

SQL

Displays the SQL necessary to re-create the trigger.


Editing a Trigger

When you edit a trigger you can edit the code manually, perform a search and replace, and compile the trigger.

Editing a Trigger Manually

To edit a trigger manually:

  1. Navigate to Object Browser:

    1. Click the SQL Workshop icon on the Workspace home page.

    2. Click Object Browser.

      Object Browser appears.

  2. From the Object list, select Triggers.

  3. From the Object Selection pane, select a trigger.

  4. Select the Code tab and then click Edit to activate manual edit mode.

  5. Click Find to perform a basic search and replace.


Note:

You can expand the Edit pane by clicking the Full Screen icon in the upper right of the pane, beneath the Create button.

Compiling a Trigger

If you edit and make changes to a function, you need to compile in order to save your changes. There is no save function because this is just a view of the object within the database.

Click Compile to compile the current trigger. Compiling re-creates the object in the database. If the compile fails, an error message display above the code.

Downloading a Trigger

Click Download to save the current trigger as a file.

Dropping a Trigger

Click Drop to delete the current trigger.