I have a MySQL stored procedure which reads and updates multiple tables, so I want it to be a transaction. Is it already transactional by default? Or do i need to do something?
MySQL 5.0+
I don't believe so. According to the manual section on BEGIN...END statements:
Within all stored programs (stored procedures and functions, triggers, and events), the parser treats BEGIN [WORK] as the beginning of a BEGIN ... END block. Begin a transaction in this context with START TRANSACTION instead.
Also see the manual on START TRANSACTION, COMMIT, and ROLLBACK Syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With