Trying to create MySql launch
CREATE TRIGGER updVisible AFTER UPDATE ON photos
FOR EACH ROW
BEGIN
IF NEW.Status = 2 THEN
UPDATE otherTable SET IsVisible=0 WHERE PID=NEW.PID
END IF;
END;
But I got an error:
You have an error in the SQL syntax; check the manual that matches your version of MySQL server for the correct syntax to use next to "END IF" on line 6
MySQL Version: 5.1.41 Community What am I doing wrong?
UPD1. It does not help
DELIMITER //
CREATE TRIGGER updVisible AFTER UPDATE ON photos
FOR EACH ROW
BEGIN
IF NEW.Status = 2 THEN
UPDATE otherTable SET IsVisible=0 WHERE PID=NEW.PID
END IF
END//
DELIMETER ;
Error:
Error code: 1064 You have an error in your SQL syntax; check the manual that matches your MySQL server version for the correct syntax to use next to "END IF END" on line 6
I have root access and use MySql Workbench 5.2.31 CE
source
share