Search your topic here

Triggers

TRIGGERS:


A trigger is defined as an action taken by database when some database related events occur.


Triggers are implicitly fired by ORACLE when triggering event occur,no matter which user is using or used by which application.


The code within the trigger called the trigger body., is made up of  PL/SQL blocks.
We can write triggers which fire on when following operations occur-


1)      DML statements (INSERT, UPDATE, DELETE).
2)     DDL statements ( CREATE or ALTER)
3)     Database events such as logon/logoff, errors, startup /shutdown, etc.


The execution of triggers is transparent to the user. Triggers are executed by the database when specific types of data manipulation commands are performed on specific tables. Such commands may include inserts, updates and deletes. Updates of specific columns may also be used as triggering events.


Because of their flexibility, triggers may supplement referential integrity. When enforcing the business rules in an application. We should first rely on the declarative referential integrity available with ORCALE: use triggers to enforce rules that cannot be coded through referential integrity.

Types of DML Triggers:

There are 12 basic types of DML triggers defined, by the type of triggering transaction and by the level at which the trigger is execute. Following are the types of DML triggers.

1) BEFORE INSERT row
2) BEFORE INSERT statement
3) AFTER INSERT row
4) AFTER INSERT statement
5) BEFORE UPDATE row
6) BEFORE UPDATE statement
7) AFTER UPDATE row
8) AFTER UPDATE statement
9) BEFORE DELETE row
10) BEFORE DELETE statement
11) AFTER DELETE row
12) AFTER DELETE statement

LEAVE A REPLY










Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.