MySQL游标
创建游标
DECLARE cursor_name CURSOR FOR select_statement;
使用游标
OPEN光标
OPEN cursor_name;
FETCH光标
FETCH cursor_name INTO var_name [, var_name] ...
CLOSE光标
CLOSE cursor_name;
循环获取游标
DECLARE emp_reault cursor for select * from emp;
DECLARE EXIT HANDLER FOR NOT FOUND set has_data=0;
然后判断has_data来退出循环。
标签:name,游标,cursor,MySQL,DECLARE,光标 From: https://www.cnblogs.com/yangxuanzhi/p/18139725