在 MySQL 触发器中引发阻止表更新的错误

2021-11-20 00:00:00 database mysql triggers

如果我在更新表之前有一个触发器,我该如何抛出阻止更新该表的错误?

If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table?

推荐答案

这是一个可行的黑客.它不干净,但看起来可能有用:

Here is one hack that may work. It isn't clean, but it looks like it might work:

本质上,您只是尝试更新不存在的列.

Essentially, you just try to update a column that doesn't exist.

相关文章