triggers - DATABASE MANGEMENT SYSTEMS B.E IV SEM A SEC...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
DATABASE MANGEMENT SYSTEMS B.E IV SEM ‘A’ SEC P.Mirunalini AP ,CSE SSNCE
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
overview b What are Triggers? b Procedures Vs Triggers b Trigger Issues b When to use Triggers? b ECA Model b Syntax b Row vs Statement Triggers b Before Vs After Triggers
Background image of page 2
What are Triggers? b Triggers are action that executes ( fire ) automatically whenever some specified event occurs. b Trigger is a PL/SQL block or PL/SQL procedure associated with a table, view, schema, or the database. b Can be either: s Application trigger : Fires when an event occurs with a particular application s Database trigger : Fires when a data event (DML) or system event (logon or shutdown) occurs on schema or database.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Procedure vs Triggers b Procedures and triggers differ in the way that they are invoked: s A procedure is explicitly executed by a user, application, or trigger. s Triggers are implicitly fired when a triggering event occurs, no matter which user is connected or which application is being used. b Note that the database stores triggers separately from their associated tables.
Background image of page 4
Trigger Issues b Triggers are not recommended way to implement integrity constraints. s Declarative constraints are checked on all relevant updates, whereas triggers are invoked only when the specified event occurs. b Trigger T1 could cause trigger T2 to fire, which could cause trigger T3 and so on (a trigger chain ). b Trigger T might even cause itself to fire again ( recursive ).
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
When to use Triggers? b Some useful purpose of triggers: s Alerting the user if some exception occurs s Debugging (e.g., monitoring references to, and/or state changes in, designated variables) s Auditing (e.g., tracking who performed what updates to which relations when) s Performance measurement (e.g., timing or tracking specified database events) s Carrying out compensating actions.
Background image of page 6
ECA Model b Trigger specifies, an event , a condition , and an action : s The event is an operation on the database (any update operations). s
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2012 for the course CSE,IT 101 taught by Professor Mirunaalini during the Spring '12 term at Indian Institute of Technology, Chennai.

Page1 / 27

triggers - DATABASE MANGEMENT SYSTEMS B.E IV SEM A SEC...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online