MySQL - Before Insert Trigger Syntax?
With MySQL 5.1.43.
I am trying to create a trigger like this:
USE `databaseA`;
DELIMITER $$
CREATE DEFINER=`root`@`localhost` trigger triggerName
BEFORE INSERT ON tableA
FOR EACH ROW BEGIN
IF(convert(new.subTime, signed) > '600') THEN
SET new.fieldA = new.fieldB;
END IF;
END$$
When I insert a record the fieldA field does not update.
Is there something wron开发者_StackOverflow中文版g with my syntax?
Can I use the CONVERT statement in the trigger?
I just tested your trigger and it works fine. Is there any error message? Also take a look at INFORMATION_SCHEMA -> TRIGGERS and check is your trigger defined properly.
精彩评论