insert,update商品数据时需要把content中只截取前8个图片tirgger语句:create trigger tri_goods_update AFTER UPDATEon ims_ewei_shop_goods for each rowbeginset @gcount = (SELECT CAST((LENGTH('content') - LENGTH(REPLACE('content',"absmiddle", ""))) / LENGTH("absmiddle") AS signed) AS count FROM ims_ewei_shop_goods where id = new.id);IF @gcount > 8 AND locate('',old.content) = 0 THENupdate ims_ewei_shop_goods set content = CONCAT(substring_index(old.content,'absmiddle',-(@gcount - 8)),'absmiddle" >') where id = new.id;END IF;END触发器创建,和修改执行后没有报错,content中的数据没有改变.
添加回答
举报
0/150
提交
取消