我需要从mysql中的存储过程中的类别中获取所有子类别级别。但我只是读过游标不能在while循环中使用。有谁知道如何做到这一点?
declare element varchar(150);
declare bDone INT;
declare remain varchar(256) default concat(category, ',');
while remain != '' do
set element = substring_index(remain, ',', 1);
declare curs CURSOR FOR select id from product_categories where product_categories.parent_id = element;
declare CONTINUE HANDLER FOR NOT FOUND SET bDone = 1;
.
.
.
end while;
product_categories包含以下字段: