且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL触发器-更新后删除

更新时间:2023-02-04 23:23:00

您可能需要做的是使用触发器的插入前"检查所添加的记录是否无效.

What you may need to do is use the 'BEFORE INSERT' of the trigger to check if the record being added is not valid.

这个SO问题提供了有关如何处置无效记录的一些详细信息:

This SO question provides some detail on how to dipose of the invalid record: Prevent Insert

另一种方法是修改程序,以将记录插入到另一个表中,该表具有清除所需表的触发器.

The alternate is to modify your program to insert a record into another table which has a trigger to purge the desired table.