0% found this document useful (0 votes)
33 views4 pages

Triggers

Uploaded by

Nabi Rasool
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views4 pages

Triggers

Uploaded by

Nabi Rasool
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Triggers

• A trigger is a plsql block or a pl/sql procedure


• Associated with a table, view, schema or the
database.
• Executes implicitly whenever a particular event
takes place
• Application trigger : fires whenever an event
occurs with a particular application
• Database trigger : fires whenever a data event
as DML.
• A trigger statement contains
• Trigger timing
• For table : before,after
• For view instead of
• Trigger event – insert,update,or delete
• Table name – on table,view
• Trigger type – row or statement
• When clause – restricting condition
• Trigger body – pl/sql block
• Before insert
• Create table ABC(A NUMBER,B Date);
• Create or replace trigger ABC_TR
• Before insert on ABC
• For each row
• Begin
• Dbms_output.put_line(‘A Rec is being
inserted.’);
• End;
•/
• Set serveroutput on
• Insert into ABC(A,B) values(1,sysdate);
• After delete
• Create or replace trigger ABC_del_TR
• After delete on ABC
• Begin
• Dbms_output.put_line(‘table is being deleted’);
• End;
•/
• Delete abc;

You might also like