cursor遊標應用
select * from tbl_student0101;
drop procedure if exists crt_std;
delimiter //
create procedure crt_std()
BEGIN
declare std_nm char(20);
declare std_age int;
declare std_tel char(11);
declare std_cur cursor for select name, age, tel from tbl_student0101;
open std_cur;
LOOP
fetch std_cur into std_nm, std_age, std_tel;
select std_nm, std_age, std_tel;
END LOOP;
close std_cur;
END;
//
DELIMITER ;
call crt_std();