Can I ask some help,I got error recursive limit 0(set by the max_sp_recursion_depth_variable) was excedded for routine sum_amount,is there a way to change my recursive function to prevent error in recursive limit ?..thank you in advance.
CREATE DEFINER=`root`@`localhost` PROCEDURE `sum_amount`(IN `p_memid` INT, OUT `tot_left_amount` DECIMAL(10,2))
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
DECLARE a decimal(10,2);
DECLARE m int;
DECLARE s decimal(10,2);
select memberid, amount into m, a from mytree
where parentid = p_memid and position = 'L';
call sum_amount(m,s);
set tot_left_amount = a + s;
END