如果触发器失败怎么办?
如果我运行插入查询,但表上有一个触发器,可以根据触发器增加另一个值,但触发器有问题,它是否仍会执行我的查询?
If I run an insert query, but I have a trigger on a table to increment another value based upon the trigger, but there's something wrong with the trigger, will it still execute my query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下参考文章应该有所帮助。基本上,BEFORE 或 AFTER 触发器期间的错误会导致导致触发器调用的整个语句失败。
您不需要测试这一点,但如果您想快速测试这一点,只需创建一个插入触发器失败的虚拟表即可。从那里结果将非常清楚。
希望我有帮助
The following reference article should help. Basically, an error during either a BEFORE or AFTER trigger results in failure of the entire statement that caused trigger invocation.
You shouldn't need to test this out, but if you wanted to quickly test this out, simple create a dummy table with a failed insert trigger. The results would be very clear from there.
Hope I helped