Question

I'm trying to create trigger in Mysql, and get the error:

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

in this trigger:

DELIMITER $$
SET @name2:='w';
CREATE TRIGGER `foo`.`test`
AFTER INSERT
    ON `foo`.`test`
    FOR EACH ROW BEGIN
    SELECT name1 INTO name2;
    END;
    $$
DELIMITER ;

What is wrong with line 2?

Was it helpful?

Solution

try this:

  DELIMITER $$

 CREATE TRIGGER `foo`.`test` AFTER INSERT
ON `foo`.`test`
FOR EACH ROW BEGIN
SET @name2:='w';
SELECT name1 INTO @name2;
END$$
DELIMITER ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top