我是靠谱客的博主 老实丝袜,这篇文章主要介绍mysql创建触发器,现在分享给大家,希望可以做个参考。

mysql创建触发器

使用update或insert触发器能创建成功,但执行语句时会报错,

1442 - Can’t update table ‘xxx’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger.

正确写法:new代表新数据

复制代码
1
2
3
4
5
6
7
8
-- 插入数据时银行卡号脱敏 create trigger data_desensitization before insert on acct for each row begin SET new.CARD_ID = CONCAT(LEFT(new.CARD_ID ,6), '****' ,RIGHT(new.CARD_ID ,4)); end;

最后

以上就是老实丝袜最近收集整理的关于mysql创建触发器的全部内容,更多相关mysql创建触发器内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(76)

评论列表共有 0 条评论

立即
投稿
返回
顶部