MySQL Trigger with transaction insert or update

主宰稳场 提交于 2019-12-12 18:32:54

问题


i'm using mysql db & java, so in my application i need to use trigger, but i need to make it save while inserting or updating. when insering new record in table A, trigger will do the work to insert some information in another table B. also when doing update for records in table A, trigger will update records for table B.

if transaction during update or insrt rolledback, does this rolled back any changes done by the trigger.??!!


回答1:


Yes, if the transaction is rolled back, the work done by the trigger will also be rolled back (unless you do some monkeying with transaction scoping inside the trigger to specifically prevent this)



来源:https://stackoverflow.com/questions/13823165/mysql-trigger-with-transaction-insert-or-update

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!