0

运行以下 SQL 命令时,我不断收到以下错误:

您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在 'DELIMITER ;; 附近使用正确的语法 CREATE TRIGGER ins_filmAFTER INSERT ON filmFOR EACH BEGIN' 在第 5 行

关于如何解决这个问题的任何想法?

代码是这样写的:

DELIMITER ;;
CREATE TRIGGER `ins_film` AFTER INSERT ON `film` FOR EACH ROW BEGIN
    INSERT INTO film_text (film_id, title, description)
        VALUES (new.film_id, new.title, new.description);
  END;;


CREATE TRIGGER `upd_film` AFTER UPDATE ON `film` FOR EACH ROW BEGIN
    IF (old.title != new.title) OR (old.description != new.description) OR (old.film_id != new.film_id)
    THEN
        UPDATE film_text
            SET title=new.title,
                description=new.description,
                film_id=new.film_id
        WHERE film_id=old.film_id;
    END IF;
  END;;


CREATE TRIGGER `del_film` AFTER DELETE ON `film` FOR EACH ROW BEGIN
    DELETE FROM film_text WHERE film_id = old.film_id;
  END;;

DELIMITER ;
4

0 回答 0