 |
|
Oracle Trigger naming standards
Oracle Database Tips by Donald Burleson
|
Database triggers are named using this convention:
table_name + trigger_type_extension
In this example, table_name is the name of the trigger's base table,
and trigger_type_extension represents one of the four types of database
triggers listed in Table D.4, plus one or more of the letters shown ibelow to
indicate which DML statements cause the trigger to fire.
The four types of Oracle triggers.
|
Trigger Type |
Extension |
Fires |
Before statement |
_B |
Once, before the DML statement acting on the table. |
Before row |
_BR |
Once for each row affected by the DML statement, before the DML
statement is executed. |
After row |
_AR |
Once for each row affected by the DML statement, after the DML
statement is executed. |
After statement |
_A |
Once, after the DML statement has finished executing. |
|
Modifications to trigger_type_extension to indicate DML
statements handled by the trigger.
|
Trigger Type Extension |
DML Statement |
D
|
The trigger fires when a DELETE statement modifies the
base table. |
I
|
The trigger fires when an INSERT statement modifies the
base table. |
U
|
The trigger fires when an UPDATE statement modifies the
base table. |
|
Thus, a BEFORE INSERT or UPDATE row level trigger on the
STUDENTS table would be named STUDENTS_BRIU.
If the length of the trigger name exceeds 30 characters when following this
standard, abbreviate the name of the trigger's base table to create the name of
the trigger. Under no circumstances should the trigger type extension be
abbreviated.
This is an excerpt from "High Performance Oracle Database
Automation", by Jonathan Ingram and Donald K. Burleson, Series Editor.