我正在尝试在Mysql中创建触发器,并收到错误:
check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TRIGGER `foo`.`test` AFTER INSERT ON `foo`.`test` FOR EACH ROW BE' at line 2
在此触发器中:
DELIMITER $$
SET @name2:='w';
CREATE TRIGGER `foo`.`test`
AFTER INSERT
ON `foo`.`test`
FOR EACH ROW BEGIN
SELECT name1 INTO name2;
END;
$$
DELIMITER ;
第2行有什么问题?
答案 0 :(得分:1)
试试这个:
DELIMITER $$
CREATE TRIGGER `foo`.`test` AFTER INSERT
ON `foo`.`test`
FOR EACH ROW BEGIN
SET @name2:='w';
SELECT name1 INTO @name2;
END$$
DELIMITER ;