# Stored Function Limitations

The following restrictions apply to [stored functions](https://mariadb.com/docs/server/server-usage/stored-routines/stored-functions).

* All of the restrictions listed in [Stored Routine Limitations](https://mariadb.com/docs/server/server-usage/stored-routines/stored-routine-limitations).
* Any statements that return a result set are not permitted. For example, a regular [SELECTs](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/select) is not permitted, but a [SELECT INTO](https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/selectinto) is. A cursor and [FETCH](https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/fetch) statement is permitted.
* [FLUSH](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush) statements are not permitted.
* Statements that perform explicit or implicit commits or rollbacks are not permitted.
* Cannot be used recursively.
* Cannot make changes to a table that is already in use (reading or writing) by the statement invoking the stored function.
* Cannot refer to a temporary table multiple times under different aliases, even in different statements.
* ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT statement which are in a stored function cannot refer to a savepoint which has been defined out of the current function.
* Prepared statements ([PREPARE](https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/prepare-statement), [EXECUTE](https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/execute-statement), [DEALLOCATE PREPARE](https://mariadb.com/docs/server/reference/sql-statements/prepared-statements/deallocate-drop-prepare)) cannot be used, and therefore nor can statements be constructed as strings and then executed.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
