MySql does not quite write a trigger when calling a stored procedure in a trigger. today, I encountered a syntax problem. I solved it with the help of a friend (DBA) and recorded it.
Requirement: the stored procedure gen_ci_property_value is called when CLASS_PROPERTY_REL deletes a record.
Problem feedback:
SQL error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delimitercreate TRIGGER cpr_del after delete on CLASS_PROPERTY_REL for each row' at line 1
Solution:
DELIMITER $ create trigger cpr_del after delete on CLASS_PROPERTY_REL for each row begin call gen_ci_property_value (); END $ DELIMITER;
Explanation:
Because the statement for creating proc is a whole, you do not want to end the execution of a line, so you need to temporarily change the DELIMITER. after the completion, 'delimiter; 'is to change the DELIMITER back to the default