Monday, September 24, 2012

SQL Triggers

SQL Trigger
       - A SQL trigger is an SQL  statements or sets of statements which is stored to be activated or fired when an event associating with a database table occurs.

Take note that though trigger is implemented in MySQL has all features in standard SQL but there are some restrictions to be aware of.

These restrictions are the followings:

      1. It is not allowed to create a trigger for views or temporary table.
      2. It is not allowed to use transaction in a trigger.
      3. Return statements is disallowed in a trigger.
      4. Creating a trigger for a database table causes the query cache invalidated.
      5. All trigger for a database table must have unique name

CREATING A TRIGGER:

SYNTAX:
(BEFORE|AFTER)_tableName_(INSERT|UPDATE|DELETE)



No comments:

Post a Comment