문제

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

도움이 되었습니까?

해결책

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$$
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top