Presentation is loading. Please wait.

Presentation is loading. Please wait.

PL/SQL Programing : Triggers

Similar presentations


Presentation on theme: "PL/SQL Programing : Triggers"— Presentation transcript:

1 PL/SQL Programing : Triggers

2 Agenda What is a Trigger? Why use them? How do they work?
Purposes of Triggers

3 What is a Trigger? Code which is executed or fired automatically when a particular type of SQL statement is executed. Triggers consist of timing conditions and actions When this happens Do this Guide to Oracle 10g

4 What can you do with Them?
Clean up data as its entered Add data to one table based on changes in another. Guide to Oracle 10g

5 Trigger Syntax CREATE OR REPLACE TRIGGER trigger_name {BEFORE|AFTER} {INSERT|UPDATE|DELETE} [OF columns] ON table_name [FOR EACH ROW [WHEN (condition)]] BEGIN Trigger PL/SQL Code goes here; END;

6 Correlation Identifiers
DML Event :OLD :NEW INSERT n/a Contains insert values (new only) UPDATE Values of the original row Values of the updated row DELETE

7 Example Trigger Guide to Oracle 10g

8 Add Credit card Support to FUDGEMART
Demo Add Credit card Support to FUDGEMART

9 Questions


Download ppt "PL/SQL Programing : Triggers"

Similar presentations


Ads by Google