> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/server-usage/stored-routines/stored-functions/stored-function-limitations.md).

# Stored Function Limitations

The following restrictions apply to [stored functions](/docs/server/server-usage/stored-routines/stored-functions.md).

* All of the restrictions listed in [Stored Routine Limitations](/docs/server/server-usage/stored-routines/stored-routine-limitations.md).
* Any statements that return a result set are not permitted. For example, a regular [SELECTs](/docs/server/reference/sql-statements/data-manipulation/selecting-data/select.md) is not permitted, but a [SELECT INTO](/docs/server/reference/sql-statements/programmatic-compound-statements/selectinto.md) is. A cursor and [FETCH](/docs/server/reference/sql-statements/programmatic-compound-statements/programmatic-compound-statements-cursors/fetch.md) statement is permitted.
* [FLUSH](/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush.md) 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](/docs/server/reference/sql-statements/prepared-statements/prepare-statement.md), [EXECUTE](/docs/server/reference/sql-statements/prepared-statements/execute-statement.md), [DEALLOCATE PREPARE](/docs/server/reference/sql-statements/prepared-statements/deallocate-drop-prepare.md)) 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" %}
