MySQL创建触发器1064错误 [英] Mysql create trigger 1064 error

查看:832
本文介绍了MySQL创建触发器1064错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的sql

**delimiter |
CREATE 
DEFINER=CURRENT_USER 
TRIGGER set_profiletype_after_insert BEFORE INSERT ON trl_translator FOR EACH ROW 
BEGIN 
UPDATE trl_profile SET trl_profile.type = 'translator' WHERE trl_profile.profile_id = NEW.translator_id
END 
|
delimiter ;**

给出的错误

[SQL] 
**CREATE 
DEFINER=CURRENT_USER 
TRIGGER set_profiletype_after_insert BEFORE INSERT ON trl_translator FOR EACH ROW 
BEGIN 
UPDATE trl_profile SET trl_profile.type = 'translator' WHERE trl_profile.profile_id = NEW.translator_id
END 
;
[Err] 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 'END' at line 6**

该如何解决?我在哪里犯错?

How to solve this ? where is the mistake i do ?

推荐答案

看起来您只需要用分号终止UPDATE语句即可.

It looks like you simply need to terminate your UPDATE statement with a semicolon.

这篇关于MySQL创建触发器1064错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆