首頁 >資料庫 >mysql教程 >mysql触发器语法错误问题

mysql触发器语法错误问题

WBOY
WBOY原創
2016-06-06 09:33:261599瀏覽

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

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

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn