Creating a Trigger With the SQL Commands Page

Previous
Previous
Next
Next

With the SQL Commands page, you can create and update triggers.

To create a trigger with the SQL Commands page:

  1. Log in to the Database Home Page. See "Logging in to the Database Home Page". To run the examples in this guide, you should log in as user HR with your password for the HR account.

  2. On the home page, click the SQL icon to display the SQL page.

  3. Click the SQL Commands icon to display the SQL Command page.

  4. On the SQL Commands page, first enter the SQL statements to create any objects that are needed in the trigger body. For example, the emp_audit table needs to be created before creating the audit_sal trigger in Example: Creating a Database Trigger WIth the AFTER Option. If a database object is referred to in the trigger code, then that object must exist for the trigger to be valid.

  5. Click the Run button to execute the SQL statements to create any supporting objects for the trigger. If the statements run successfully, delete the statements from the SQL Commands page. Otherwise, update the statements so they run successfully.

  6. On the SQL Commands page, enter the PL/SQL code to create the trigger after any objects that are needed by the trigger are created. For an example of code to create a trigger, see Example: Creating a Database Trigger WIth the AFTER Option.

  7. Click the Run button to execute the PL/SQL code to create the trigger. Correct the code if it does not execute successfully.

  8. If you want to save the PL/SQL code for future use, click the Save button.

  9. In the Name field, enter a name for the saved PL/SQL code. You can also enter an optional description. Click the Save button to complete the action.

  10. To access the saved PL/SQL code, click the Saved SQL tab and select the name of the saved PL/SQL code that you want to access.


See Also:

Oracle Database Express Edition Application Express User's Guide for detailed information about using SQL Commands