gpt4 book ai didi

php - TRIGGER CREATED 成功,但 information_schema TRIGGERS 表中没有触发器

转载 作者:可可西里 更新时间:2023-11-01 08:35:10 24 4
gpt4 key购买 nike

您好,我正在尝试使用触发器,我的 MySQL 版本是 5.5.8

事情是当我创建触发器时,PHPMyadmin 说它已成功创建,

这是我的触发器

DELIMITER $$
CREATE TRIGGER `check_pupil_before_insert` BEFORE INSERT ON `pupil_data`
FOR EACH ROW BEGIN
IF CHAR_LENGTH( NEW.DateOfBirth ) < 4 THEN
SIGNAL SQLSTATE '12345'
SET MESSAGE_TEXT := 'check constraint on pupil_data.DateOfBirth failed';
END IF;
END$$
DELIMITER ;

它说

Your SQL query has been executed successfully
DELIMITER $$ CREATE TRIGGER `check_pupil_before_insert` BEFORE INSERT ON `pupil_data`
FOR EACH
ROW BEGIN
IF CHAR_LENGTH( NEW.DateOfBirth ) <4
THEN SIGNAL SQLSTATE '12345'
SET MESSAGE_TEXT := 'check constraint on pupil_data.DateOfBirth failed';

END IF ;

但是当我

select * from information_schema.triggers

MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0843 sec )
SELECT *
FROM information_schema.triggers
LIMIT 0 , 30

为什么会这样,请帮助我,在此先感谢。

最佳答案

IMAGE

检查这个..它会帮助你......并确保查询与图像中显示的相同,将“:=”更改为“=”

关于php - TRIGGER CREATED 成功,但 information_schema TRIGGERS 表中没有触发器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15541318/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com