您好我正在尝试使用触发器,我的 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
为什么会发生这种情况,请帮助我,在此先感谢。