I have noticed that START TRANSACTION
automatically COMMIT
the previous queries. Because of this and the fact that I have several stored procedure
From https://dev.mysql.com/doc/refman/5.5/en/implicit-commit.html:
Transactions cannot be nested. This is a consequence of the implicit commit performed for any current transaction when you issue a START TRANSACTION statement or one of its synonyms.
I suspect that the problem can be solved by using SET autocommit=0;
instead of START TRANSACTION;
. If autocommit is already 0, it will have no effect.
See also Does setting autocommit=0 within a transaction do anything?