简体   繁体   中英

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 wrong 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM