Call (800) 766-1884 for Oracle support & training
Free Oracle Tips


Oracle Consulting Support
Oracle Upgrades
Use New Oracle Features
Oracle Replication Support
Oracle Training
Remote Oracle DBA
System Documentation
Oracle Tips
Oracle Performance
 

Free Oracle Tips


 

HTML Text

BC Oracle tuning

Oracle training

Oracle support

Remote Oracle

 

 

   
 

Oracle Database Triggers
Oracle Tips by Burleson
 

Database triggers are the ideal tool for enforcing business rules that relate directly to data. Each database trigger is associated with a single table in the database and is configured to fire at a certain point when data is modified. Typical uses of database triggers include the following:

  • Checking columns for conformity to complex rules that cannot be enforced with check constraints.

  • Updating relevant data in other tables.

  • Marking newly created or recently modified rows for another process to analyze.

  • Ensuring that columns are populated.

  • Signaling that a particular event has occurred.

The real strength of database triggers is that a trigger always fires when a defined action is performed on the trigger’s associated table. Even statements executed via the command line in SQL*Plus will fire a trigger, making triggers the perfect method for enforcing business rules. Triggers can be written to fire at both statement level and row level.

Statement-level triggers fire once for each statement (or transaction) that affects the associated table. For instance,

UPDATE STUDENTS
SET    overall_gpa = 4.0;

would fire a statement-level trigger once, no matter how many rows of data were affected by the statement.

Row-level triggers fire once for each row affected by a statement that affects the trigger’s associated statement. For instance,

UPDATE STUDENTS
SET    overall_gpa = 4.0;

would fire a row-level trigger once for each row in the STUDENTS table.

Triggers are cued by specific events. A trigger that fires when its associated table is updated does not fire when a new row is inserted into the associated table, unless the same trigger is coded to fire for both updates and inserts on the associated table. Triggers can be written to fire when DELETE, INSERT, and UPDATE statements affect the trigger’s associated table.


This is an excerpt from the book "High Performance Oracle Database Automation" by Jonathan Ingram and Donald K. Burleson, Series Editor.

  
 

Oracle performance tuning software 
 
 
 
 

Oracle performance tuning book

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

   

Copyright © 1996 -  2014 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation. 

Hit Counter