Wednesday, 24 February 2016

We can fire the Triggers in two Levels:

We can fire the Triggers in two Levels:
1.Statement Level Trigger
2. Row Level Trigger

1.Statement Level Trigger:


  • It specifies that a trigger will be fired on behalf of the trigger statement.The statement trigger does not depend on the number of rows affected(or even if no row is affected) for example,If the delete statement deletes multiple rows of a table, the trigger will be fired only once.
  • The statement level triggers are useful when the code in the trigger body does not depend on the data provided by the triggered statement or the rows affected by the trigger statement.The statement level trigger is a default trigger type.

2.Row Level Trigger:


  • The Row level Trigger specifies that a trigger will be fired each time a row in a table is affected by the trigger statement  for example,if the update statement affects multiple rows of a table ,the trigger will be fired once for each row. 
  • If the trigger statement does not affect any row, the row level trigger will not be executed. The Row level triggers are useful when the code in the trigger body depends upon the data provided by the trigger statement or the rows affected by the trigger statement. 

No comments:

Post a Comment

If you Like my blog Spread it and help friends for whom this blog is useful for their career.