← Back to team overview

maria-discuss team mailing list archive

New Question: Trigger error

 

Hello,

A new question has been asked in "Triggers" by shadowfoxx_49588. Please answer it at http://mariadb.com/kb/en/trigger-error/ as the person asking the question may not be subscribed to the mailing list.

--------------------------------
Hello, i'm trying to create check trigger between two columns. But get query error. Structure of columns is: ,,`start_t` (time) , `end_t` (time),,
The goal is hours in `end_t` don't be same with `start_t` (e.g. 11:00 > 11:00)

Here is query code:
,,CREATE TRIGGER `check_times` BEFORE INSERT ON `schedule` FOR EACH ROW
BEGIN
DECLARE v_end_time time;
SELECT end_t INTO v_end_time FROM `schedule` WHERE fn_stud = NEW.fn_stud;
IF NEW.start_t > v_end_time THEN SET NEW.fn_stud = NULL;
END IF;
END;,,

MySQL says:  #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1

Don't understand what is wrong. Can anyone explain? Thanks.
--------------------------------

To view or answer this question please visit: http://mariadb.com/kb/en/trigger-error/