C
C
coderisimo2016-07-18 03:41:46
MySQL
coderisimo, 2016-07-18 03:41:46

Why do I get a syntax error when creating a trigger?

I create a trigger through the PHP My ADMIN interface. I export from it, paste it back into it and ... a syntax error!
here it goes with a bang

CREATE TRIGGER `after_deal_creating` BEFORE INSERT ON `deals`
 FOR EACH ROW INSERT INTO  `notifications` 
SET  `new_quote_status` = NEW.`quote_status` ,
`deal_id` = NEW.`id` ,
`broker_id` = NEW.`broker_id` ,
`creator_id` = NEW.`creator_id` ,
`box_user_id` = NEW.`box_user_id`

and here is the error in the line `box_user_id`= NEW.`box_user_id`;
CREATE TRIGGER `after_deal_updating` BEFORE UPDATE ON  `deals` FOR EACH ROW IF NEW.`quote_status` <> OLD.`quote_status` THEN INSERT INTO  `notifications` 
SET  `new_quote_status` = NEW.`quote_status` ,
`deal_id` = OLD.`id` ,
`broker_id` = NEW.`broker_id` ,
`creator_id`= OLD.`creator_id`,
`box_user_id`= NEW.`box_user_id`; // вот здесь ошибка!!
END IF;

Server version: 5.5.45-

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korovin, 2016-07-18
@coderisimo

Google mysql delimiter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question