如何遍历查询结果,然后调用MySQL存储过程中的其他存储过程?

如何遍历查询结果,然后调用MySQL存储过程中的其他存储过程?,mysql,stored-procedures,cursor,mysql-workbench,Mysql,Stored Procedures,Cursor,Mysql Workbench,现在我可以编写单独的存储过程了 -- get the total query id result select id from book where bookprice>10; -- only pass a single id call sp_refreshbook(id); 如何将它们合并在一起?现在我想搜索id结果,并在新的存储过程中调用结果中每个id中的sp_refreshbook。我自己用游标解决了这个问题 -- get the total query id result se

现在我可以编写单独的存储过程了

-- get the total query id result
select id from book where bookprice>10;
-- only pass a single id
call sp_refreshbook(id); 

如何将它们合并在一起?现在我想搜索id结果,并在新的存储过程中调用结果中每个id中的
sp_refreshbook

我自己用游标解决了这个问题

-- get the total query id result
select id from book where bookprice>10;
-- only pass a single id
call sp_refreshbook(id); 
open v_result_cur;
repeat
fetch v_result_cur into v_id;
IF NOT v_done THEN
select v_id; 
END IF;
until v_done end repeat;
close v_result_cur;

向我们展示
sp_refreshbook
puppy,我们可以创建一个新的sp_refreshbookLooper