I executed multiple queries SQL statement in between START TRANSACTION
and COMMIT
.
If anything goes wrong, the process terminated in between without executing COMMIT
and nothing will happen to the database. So far, everything seems fine without executing ROLLBACK
.
My doubt is, is it necessary to run ROLLBACK
if anything bad happens?
If you have autocommit
disabled, any non-commited transaction is always rolled back at the end of the session.
You can read more about it on the documentation
That said, I'd be explicit about it (just in case the session doesn't end when "something goes wrong") and call it.