Database Reference
In-Depth Information
Triggers should be used to ensure data consistency (case, formatting,
and so on). The advantage of performing this type of processing in a
trigger is that it always happens, and happens transparently, regardless
of client application.
One interesting use for triggers is in creating an audit trail, as seen
in this chapter. Using triggers it would be easy to log changes (even
before and after states if needed) to another table.
Unfortunately the CALL statement is not supported in MariaDB trig-
gers. This means that stored procedures cannot be invoked from
within triggers. Any needed stored procedure code would need to be
replicated within the trigger itself.
Summary
In this chapter, you learned what triggers are and why they are used. You
learned the trigger types and the times that they can be executed. You also saw
examples of triggers used for INSERT , DELETE , and UPDATE operations.
 
 
Search WWH ::




Custom Search