gpt4 book ai didi

MySQL不支持递归函数?为什么?从何时起?

转载 作者:可可西里 更新时间:2023-11-01 06:42:17 26 4
gpt4 key购买 nike

我写了一个存储的 FUNCTION,它递归地调用自己。

然而,当我在查询中运行它时,我得到了这个无耻的错误:

Error: 1424 SQLSTATE: HY000 (ER_SP_NO_RECURSION)

Message: Recursive stored functions and triggers are not allowed.

“不允许”?
正确的。为什么我们不同时禁用 WHILE 循环呢?

我能否以任何方式启用递归函数?
我找到了一个 bug report ,但有任何解决方法吗?
我在 Windows XP(XAMPP 服务器)上运行 MySQL 5.1.41。

最佳答案

MySQL 5.1 支持递归存储过程,但不支持递归函数。引用 docs :

Stored functions cannot be recursive.

Recursion in stored procedures is permitted but disabled by default. To enable recursion, set the max_sp_recursion_depth server system variable to a value greater than zero. Stored procedure recursion increases the demand on thread stack space. If you increase the value of max_sp_recursion_depth, it may be necessary to increase thread stack size by increasing the value of thread_stack at server startup.

关于MySQL不支持递归函数?为什么?从何时起?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3536538/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com