1943
MySQLERRORNotableStored RoutinesHIGH confidence
Recursive stored procedure call is not supported
Production Risk
Low — call is rejected; no side effects.
What this means
A prepared statement or stored procedure attempted a direct recursive call. MySQL does not allow prepared statements to call themselves recursively.
Why it happens
- 1A prepared statement EXECUTE inside a stored procedure calls the same prepared statement.
- 2Recursive CALL inside a prepared statement context.
How to reproduce
trigger — this will error
trigger — this will error
-- EXECUTE of a prepared statement that itself calls EXECUTE on the same statement
expected output
ERROR 1943 (HY000): Recursive stored procedure call is not supported.
Fix 1
Rewrite the logic iteratively using a LOOP or WHILE construct
Rewrite the logic iteratively using a LOOP or WHILE construct
-- Use a WHILE loop in the stored procedure instead of recursion
Why this works
Iterative approaches avoid the recursion restriction in prepared statements.
Fix 2
Enable and use stored procedure recursion via max_sp_recursion_depth
Enable and use stored procedure recursion via max_sp_recursion_depth
SET max_sp_recursion_depth = 10; CALL my_recursive_proc(n);
Why this works
For stored procedures (not prepared statements), set max_sp_recursion_depth > 0.
Sources
Official documentation ↗
MySQL 8.0 — 1943 ER_PS_NO_RECURSION
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev