Name
SQL-01: Start a transaction explicitly with the START TRANSACTION statement
Synopsis
Although MySQL will automatically initiate a transaction on
your behalf when you issue DML statements, you should issue an
explicit START TRANSACTION
statement in your program to mark the beginning of your
transaction.
It’s possible that your stored program might be run within a
server in which autocommit
is
set to TRUE, and by issuing an explicit START TRANSACTION
statement you ensure
that autocommit
does not remain
enabled during your transaction. START
TRANSACTION
also aids readability by clearly delineating
the scope of your transactional code.
Get MySQL Stored Procedure Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.