tags:

views:

94

answers:

1

Using MySQL 5.1.x

Trying to add a trigger to a table:

DELIMITER $$

CREATE TRIGGER 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).

+1  A: 

In a MySQL trigger, you cannot invoke DML on the table that fires the trigger.

Quassnoi
Note to self: DML = Data Manipulation Language
John M
Thanks @Quassnoi - that definitely is annoying...off to another solution.
John M