Reputation: 14439
I try to create following trigger:
DELIMITER $$
CREATE trigger insert_processor
BEFORE INSERT ON tbl
FOR EACH ROW BEGIN
set new.val = trim(new.val);
set new.val2 = upper(new.val);
END$$
and it fails with following error message
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 8
What could be a reason?
MySql server version: 5.1.40-community
Client: phpMyAdmin 3.3.8
Upvotes: 0
Views: 3025
Reputation: 121902
Have a look if there is a DILIMITER field in your phpmyadmin version, just below the SQL editor. Set your delimiter there, for example - '$$', and write this SQL code -
CREATE trigger insert_processor
BEFORE INSERT ON tbl
FOR EACH ROW BEGIN
set new.val = trim(new.val);
set new.val2 = upper(new.val);
END$$
Upvotes: 2