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

时间:2013-03-21 07:01:40

标签: php mysql sql triggers phpmyadmin

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

为什么会发生这种情况,请提前帮助我。

1 个答案:

答案 0 :(得分:2)

IMAGE

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