MySQL - ERROR 1406:Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded...

现象:

执行一个存储过程,出现如下错误:

请更正下列输入错误:

CDbCommand 无法执行 SQL 语句: SQLSTATE[HY000]: General error: 1456 Recursive limit 0 (as set by the max_sp_recursion_depth variable) was exceeded for routine sp_rebuild_booktype. The SQL statement executed was: call sp_rebuild_booktype (:parentid)

原因:

因为存储过程递归调用了,但是没有设置递归层次,所以导致出现这个错误。

解决:

在存储过程中增加如下代码:

SET @@max_sp_recursion_depth = 10;

 

或者在MYSQL中执行如下命令设置全局变量:

SET global max_sp_recursion_depth = 10;

 

或者在MY.INI中增加如下参数:

max_sp_recursion_depth = 10

猜你喜欢

转载自blog.csdn.net/qq_40741855/article/details/89179029