【发布时间】:2016-12-16 14:33:41
【问题描述】:
我正在尝试使用从另一个查询接收的一组值调用存储过程,我想知道如何使用来自查询的值调用另一个过程。这是我的代码
CREATE DEFINER=`root`@`localhost` PROCEDURE `temp`(IN u_id int)
BEGIN
#below query will give me all the u_id values that i need to use(ex : 2,8,9)
Declare cur cursor for select r_id from temp.usr_rl where u_id in (u_id);
#below i would like to use the u_id values and run the below procedure in a loop for each value in u_id
open cur;
repeat
fetch cur into a;
if not done then
call get_r(a);
end if;
until done end repeat;
close cur;
END
【问题讨论】:
标签: mysql stored-procedures cursor