我有以下存储过程:
DECLARE CURSORITO CURSOR FOR SELECT issues.id FROM issues
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done=1;
OPEN CURSORITO;
REPEAT
FETCH CURSORITO INTO c_id ;
IF NOT done THEN
-- TOTAL HOURS
SELECT SUM(hours) INTO c_Tot_Horas FROM time_entries WHERE issue_id=c_id;
INSERT INTO TOTAL (ID,TOT) VALUES c_id,c_Tot_Horas ;
END IF;
UNTIL done END REPEAT;
但是当“Total Hours Querys”没有数据时,进程退出repeat部分,将“Done”变量设置为true
我应该怎么做才能很好地完成这个过程,即围绕所有光标走动?