3

您好我正在尝试使用触发器,我的 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

为什么会发生这种情况,请帮助我,在此先感谢。

4

1 回答 1

2

图片

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

于 2013-03-21T07:15:15.697 回答