Home  >  Article  >  Database  >  mysql触发器语法错误问题

mysql触发器语法错误问题

WBOY
WBOYOriginal
2016-06-06 09:33:261565browse

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

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn