Knowledge Walls
John Peter
Pune, Maharashtra, India
Procedure Recursion in Procedure of MySQL
5886 Views
How to create recursion in Mysql Procedures?
-- Mysql version should be >= 5.

-- Have to set system parameters. This means putting the recursion count limit.
SET @@GLOBAL.max_sp_recursion_depth = 255; 
SET @@session.max_sp_recursion_depth = 255;

-- change thread_stack size in in.cnf file
thread_stack = 64M
or
thread_stack = 128M
Recursion Procedure
DELIMITER $$
CREATE PROCEDURE samp()
BEGIN
    SET @@GLOBAL.max_sp_recursion_depth = 255;
    SET @@session.max_sp_recursion_depth = 255;

     -- statements

    CALL samp();
END
$$
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details