I want to modify a working trigger that looks like this:
CREATE TRIGGER j_update BEFORE UPDATE ON d
FOR EACH ROW
INSERT INTO j (
stampOld, stampNew
)
VALUES (
OLD.stamp, NEW.stamp
);
to execute only on the success of an IF statement. I can't get the right syntax for this modification.
I'm trying to achieve the following:
CREATE TRIGGER j_update BEFORE UPDATE ON d
FOR EACH ROW
IF (1=1) THEN
INSERT INTO d (
stampOld, stampNew
)
VALUES (
OLD.stamp, NEW.stamp
); /* <--- LINE 21 */
END IF;
Result: ERROR 1064: Check for right syntax near '' at line 21
Things I've tried:
- wrapping the
IF ... END IF;inBEGIN .. END; - switching delimiter to $$
I'm using MySQL 5.0.95 for RHEL.
Any help is greatly appreciated.
BEGIN...ENDand an alternateDELIMITER, and the finalENDshould be terminated with the alt delimiter.