Using MySQL 5.1.x
Trying to add a trigger to a table:
DELIMITER $$
CREATE TRIGGER 开发者_JAVA百科group AFTER INSERT ON dataTable
FOR EACH ROW BEGIN
UPDATE dataTable SET groupName = mid(longName,1,4) WHERE groupNAME IS NULL;
END$$
When I insert a record there is no update made. Is there a syntax error? Or can I not run the Update query on the after insert event?
UPDATE: There are 2 triggers on this table (a AFTER INSERT and BEFORE UPDATE).
In a MySQL
trigger, you cannot invoke DML
on the table that fires the trigger.
精彩评论