我已经在HeidiSQL IDE中为mysql通过IDE的助手创建了这个触发器,它工作得非常好。如果我复制IDE生成的创建代码并尝试在phpmyadmin上运行它,我会得到一个SQL语法错误,我无法解决如何修复它。任何人都可以帮助我吗?
CREATE TRIGGER `teste` AFTER UPDATE ON `ilmug_virtuemart_products` FOR EACH ROW BEGIN
IF (NEW.origem_sync <> 0) THEN
INSERT INTO sincronizar (dataHora,
tipoMovimento,
entidade,
id,
version,
STATUS)
VALUES (CURRENT_TIMESTAMP(),
'update',
'virtuemart_products',
NEW.virtuemart_product_id,
NEW.version,
'pendente');
END IF;
END;
答案 0 :(得分:0)
答案 1 :(得分:0)
使用DELIMITER
。
DELIMITER $$
CREATE TRIGGER `teste` AFTER UPDATE ON `ilmug_virtuemart_products` FOR EACH ROW
BEGIN
IF (NEW.origem_sync <> 0) THEN
INSERT INTO sincronizar (dataHora,
tipoMovimento,
entidade,
id,
version,
STATUS)
VALUES (CURRENT_TIMESTAMP(),
'update',
'virtuemart_products',
NEW.virtuemart_product_id,
NEW.version,
'pendente');
END IF;
END$$
DELIMITER ;