Home What is the issue with this trigger (for the right syntax to use near '' )
Reply: 0

What is the issue with this trigger (for the right syntax to use near '' )

user796
1#
user796 Published in June 20, 2018, 1:35 am

Please I did this trigger to update table rating after each insert when 2 columns (id_prof,id_etud) inserted are already in the table but it gives mi this error

> #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 6

The trigger :

CREATE TRIGGER Before_Insert_Rate
BEFORE INSERT ON rating
FOR EACH ROW
BEGIN
  IF (EXISTS(SELECT * FROM rating WHERE id_prof=NEW.id_prof and id_etud = NEW.id_etud)) THEN
    UPDATE `rating` SET `rate` = NEW.rate WHERE `id_prof` = NEW.id_prof and `id_etud` = NEW.id_etud; 
    ELSE INSERT INTO rating VALUES (NEW.idprof,New.rate,New.id_etud);
  END IF
END
DELIMITER ;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.323112 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO