Reputation: 17586
hi i am trying to use triggers , my MySQL version is 5.5.8
the thing is when i create the trigger , PHPMyadmin says it is created successfully ,
this is my trigger
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 ;
it says
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 ;
but when i
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
why is this happening , please help me , thanks in advance.
Upvotes: 3
Views: 759
Reputation: 6950
Check this.. It will help you ... and make sure query is same as is shown in image change ":=" to "="
Upvotes: 2