Error in creating TRIGGER to limit insert on certain days
Posted by:
Flav Cast
Date: January 24, 2009 01:22AM
hi guys,
i need some help... im new to mysql trigger and functions... can you'll please try and help me out from this error
when i try to create a trigger with this code i get error for sysntax in Mysql: ---
CREATE TRIGGER try_counselor
before insert on counselor FOR EACH ROW BEGIN
if (DAYNAME(NOW()) IN ('SATURDAY','SUNDAY')) OR
(TIME_FORMAT(NOW(),'%H:%i')
NOT BETWEEN '08:00' AND '10:00')
THEN RAISE_APPLICATION_ERROR (-20500,'you cant do that.. Sorry');
END IF;
END;
and when i try to modify the above code and use
CREATE TRIGGER try_counselor
before insert on counselor FOR EACH ROW BEGIN
IF (DAYNAME(NOW()) IN ('SATURDAY','SUNDAY')) OR
(TIME_FORMAT(NOW(),'%H:%i') NOT BETWEEN '08:00' AND '10:00')
THEN SELECT CURDATE();
END IF;
END;
i get error for "YOU ARE NOT ALLOWED TO RETURN A RESULT SET IN TRIGGER"
PLEASE HELP...
Regards
Subject
Views
Written By
Posted
Error in creating TRIGGER to limit insert on certain days
4961
January 24, 2009 01:22AM
2262
January 24, 2009 09:15AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.