Why Learn It?
 

Using Triggers

Previous previous|next Next Page


While working with a database application, you may want to add programmatic functionality that executes when specific operations occur in the database. For example, there may be typical scenarios such as the following:

  • Example 1: You may want to insert data into a table. You find that the new data is inconsistent with the existing data in the table. You may want the system to raise an error that will cause the transaction to be rolled back.

  • Example 2: You may want the system to record information such as the timing and the details of the user modifying data in a table.

Triggers help the user deal with these and other complex situations. A trigger is a PL/SQL block or a PL/SQL procedure associated with a table, view, schema, or database. Triggers are used to ensure data integrity by checking on data in a consistent fashion. A trigger executes implicitly whenever a particular event takes place.

  • Improved data security
  • Improved data integrity

You will watch Sheila create and manage triggers.