7.1. Comparing Stored Routines, Triggers, and Events7.2. Using Triggers7.2.1. Creating a trigger7.2.2. Dropping a trigger7.2.3. Multiple SQL statements in triggers7.2.4. Changing a trigger7.2.5. Triggers on views and temporary tables7.2.6. Trigger runtime behavior7.2.6.1. Changing the sql_mode of a trigger7.2.6.2. Character set and collation7.2.6.3. Changing whom a trigger is invoked as7.2.7. Finding all triggers7.2.8. Trigger storage and backup7.2.9. Triggers and replication7.2.10. Trigger limitations7.3. Using Stored Routines7.3.1. Performance implications of stored routines7.3.2. Stored procedures vs. stored functions7.3.3. Creating a stored routine7.3.4. Invoking a stored procedure7.3.5. Dropping a stored routine7.3.6. Multiple SQL statements in stored routines7.3.7. INOUT arguments to a stored procedure7.3.8. Local variables7.3.9. Stored routine runtime behavior7.3.9.1. sql_mode7.3.9.2. Character set and collation7.3.9.3. How the stored routine runs7.3.10. Options when creating routines7.3.10.1. Comments7.3.10.2. Language7.3.10.3. Determinism7.3.10.4. SQL usage7.3.10.5. Full CREATE PROCEDURE Syntax7.3.11. Creating a basic stored function7.3.12. Full CREATE FUNCTION syntax7.3.13. Invoking a stored function7.3.14. Changing a stored routine7.3.15. Naming: stored routines7.3.16. Stored procedure result sets7.3.17. Stored routine errors and warnings7.3.18. Conditions and handlers7.3.18.1. Handlers7.3.18.2. Conditions7.3.19. Stored routine flow control7.3.19.1. IF7.3.19.2. CASE7.3.19.3. WHILE7.3.19.4. REPEAT7.3.19.5. LOOP7.3.19.5.1. ITERATE7.3.19.5.2. LEAVE7.3.20. Recursion7.3.21. Stored routines and replication7.3.22. Stored function limitations7.3.23. Stored routine backup and storage7.4. Using Cursors7.5. Using Events7.5.1. Turning on the event scheduler7.5.2. Creating an event7.5.3. Dropping an event7.5.4. Multiple SQL statements in events7.5.5. Start and end times for periodic events7.5.6. Event status7.5.7. Finding all events7.5.8. Changing an event7.5.9. After the last execution of an event7.5.10. Event logging7.5.11. Event runtime behavior7.5.11.1. sql_mode7.5.11.2. Character set and collation7.5.11.3. Changing whom an event is invoked as7.5.12. Event limitations7.5.13. Event backup and storage7.6. Summary