Week 09 Notes 1

A Stored Procedure example for Logging errors:

http://www.pmf.ni.ac.rs/pmf/licne_prezentacije/230/prezentacija/mysql-storedprocedures.pdf  (p.29 Error Handling) shows a detailed example of how to use stored procedures to log error messages.

 

XAMMP – a mysql / web server

http://www.apachefriends.org/index.html

 

Triggers

Must have mysql admin privileges to create a trigger.

 

Way to execute a set of statements when inserts, updates, or deletes happen.

 

Trigger can be called BEFORE, AFTER, or INSTEAD OF the insert, update, or delete.

 

Can write the statements in a BEGIN … END block associated with the trigger itself, or CALL a stored procedure. 

Example

Do not allow courses to be deleted from the course table.

When a course or student is deleted, copy the record to a table storing deleted records.

 

initTrigger.sql