I have the fallowing procedure:
DELIMITER $$
CREATE OR REPLACE PROCEDURE add_comments
AS
BEGIN
DECLARE var INT;
SELECT grade INTO var FROM table1;
IF (var <= 7) THEN
UPDATE table2 set comment = not_good;
ELSE
UPDATE table2 set comment = good;
END IF;
END$$
comment, not_good and good are all columns from table2
but it gives me the 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 'AS
BEGIN
IF (var <= 7)
BEGIN
UPDATE table2 set comment ' at line 3
Can't find out the problem, can someone help me with this? Thanks!
Aucun commentaire:
Enregistrer un commentaire