All pages
Powered by GitBook
1 of 1

Loading...

Stored Routine Limitations

Stored routines have specific restrictions, such as prohibiting certain SQL statements (e.g., LOAD DATA) and disallowing result sets in functions.

The following SQL statements are not permitted inside any stored routines (stored functions, stored procedures, events or triggers).

  • ALTER VIEW; you can use CREATE OR REPLACE VIEW instead.

  • LOAD DATA and LOAD TABLE.

  • CHANGE MASTER TO

  • is permitted, but the statement is handled as a regular .

  • and .

  • References to within prepared statements inside a stored routine (use instead).

  • is treated as the beginning of a block, not a transaction, so needs to be used instead.

  • The number of permitted recursive calls is limited to . If this variable is 0 (default), recursivity is disabled. The limit does not apply to stored functions.

  • Most statements that are not permitted in prepared statements are not permitted in stored programs. See for a list of statements that can be used. , and are exceptions, and may be used in stored routines.

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

This page is licensed: CC BY-SA / Gnu FDL

INSERT DELAYED
INSERT
LOCK TABLES
UNLOCK TABLES
local variables
user-defined variables
BEGIN (WORK)
BEGIN END
START TRANSACTION
max_sp_recursion_depth
Prepare Statement:Permitted statements
SIGNAL
RESIGNAL
GET DIAGNOSTICS
Stored Function Limitations
Trigger Limitations
Event Limitations