Stored Routine Limitations
You are viewing an old version of this article. View
the current version here.
The following SQL statements are not permitted inside any stored routines (stored functions, stored_procedures, events or triggers).
- Many SQL not permitted in prepared statements.
- ALTER VIEW (this was permitted outside of stored functions before MariaDB/MySQL 5.1.21).
- LOAD DATA and LOAD TABLE.
- INSERT DELAYED is permitted, but the statement is handled as a regular INSERT.
- LOCK TABLES and UNLOCK TABLES.
- References to local variables within prepared statements inside a stored routine (use user-defined variables instead).
- BEGIN (WORK) is treated as the beginning of a BEGIN END block, not a transaction, so START TRANSACTION needs to be used instead.
- The number of permitted recursive calls is limited to max_sp_recursion_depth. If this variable is 0, recursivity is disabled.
There are also further limitations specific to the kind of stored routine.
Note that, if a stored program calls another stored program, the latter will inherit the caller's limitations. So, for example, if a stored procedure is called by a stored function, that stored procedure will not be able to produce a result set, because stored functions can't do this.
See Also
Comments
Comments loading...
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.