这里是。它应该循环 120,000 次,但它只循环了两次。SELECT DISTINCT barcode FROM albumitemdetails_custom;
手动运行时返回 120,000 行。我的代码有什么问题?
DELIMITER $$
CREATE DEFINER=`testuser`@`%` PROCEDURE `AlbumMover`()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE barcode varchar(100);
DECLARE cur1 CURSOR FOR SELECT DISTINCT barcode FROM albumitemdetails_custom;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN cur1;
REPEAT
FETCH cur1 INTO barcode;
CALL AlbumMoverGenre(barcode);
CALL AlbumMoverProducer(barcode);
UNTIL done END REPEAT;
CLOSE cur1;
END