SQL Syntex Parse Error..
CREATE TRIGGER trgInsertA_SomeTable AFTER INSERT ON SomeTable
FOR EACH ROW BEGIN
-- -------------------------------------------------------
-- Comment
-- -------------------------------------------------------
DECLARE __SomeColumn VARCHAR(3) DEFAULT '0'; -- Column Comment
-- to do...
END;
SQL 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 8
DROP TRIGGER IF EXISTS trgInsertA_SomeTable;
CREATE TRIGGER trgInsertA_SomeTable AFTER INSERT ON SomeTable
FOR EACH ROW BEGIN
-- -------------------------------------------------------
-- Comment
-- -------------------------------------------------------
DECLARE __SomeColumn VARCHAR(3) DEFAULT '0'; -- Column Comment
-- to do...
END;
SQL 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
You need to change the query delimiter for HeidiSQL, so it's not semicolon but something else. You can either change the delimiter using the button with the red semicolon on it, on the main toolbar. Or by adding a client-side DELIMITER command:
DELIMITER //
DROP TRIGGER... //
CREATE TRIGGER trgInsertA_SomeTable AFTER INSERT ON SomeTable
FOR EACH ROW BEGIN
DECLARE __SomeColumn VARCHAR(3) DEFAULT '0'; -- Column Comment
-- to do...
END//
DELIMITER ;
Please login to leave a reply, or register at first.