使用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代表新数据
-- 插入数据时银行卡号脱敏
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;