欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mysql触发器语法错误问题

程序员文章站 2022-04-11 13:53:45
...
mysqlsql数据库触发器

CREATE TRIGGER tradecost
AFTER UPDATE ON fentrust
FOR EACH ROW
BEGIN
DECLARE old_account DECIMAL(16,6)
DECLARE old_fid INT(10)
DECLARE trade_account DECIMAL(16,6)

SET old_fid = SELECT old_fid FROM fentrust WHERE old.fEntrustType = 1 AND old.fstatus = 1 AND new.fstatus IN(2,3)
SET trade_account = (SELECT fsuccessamount FROM fentrust WHERE old.fEntrustType = 1 AND old.fstatus = 1 AND new.fstatus IN(2,3))
SET old_account = (SELECT ftotalrmb FROM fwallet WHERE fid = old_fid)

UPDATE fwallet SET ftotalRMB = (old_account-trade_account*0.005)

END

上面的语法有问题 总报错 求助应该怎么写 谢谢