The MYSQL triggers refer to a program which automatically gets executed when an event associated with the database occurs. The events of a database which may cause triggers to execute are INSERT, UPDATE and DELETE. Triggers are similar to stored procedures except they are not called same as in procedures. The triggers can be executed before an event or after an event occurs. If there is an insert event, a trigger can be defined to be executed before insert operation or after it. Triggers are introduced from MYSQL version 5.0.2.
Triggers help in automating database operations. User do not have to wait for a scheduled task to run a database operation, but may program a trigger or triggers to execute upon an event (or before) occurs). Triggers also automatically catch errors in business logic and report.
The triggers, however, cannot be extended for all validations. For instance, client applications do not have knowledge of what happens in database layer when triggers are invoked. It cannot be invoked for commands such as SHOW, LOAD DATA, RETURN, LOAD TABLE, COMMIT, ALTER, CREATE, DROP, RENAME etc...
No comments have been made yet.
Please login to leave a comment. Login now