【MySQL】MySQL PLSQL Demo - 006.循环(WHILE DO and FOR LOOP)
WHILE DO
drop procedure if exists p_while_do; create procedure p_while_do() begin declare i int; set i = 1; while i <= 10 do select concat('index : ', i); set i = i + 1; end while; end; call p_while_do();
FOR LOOP
drop procedure if exists p_for_loop; create procedure p_for_loop() begin declare i int; set i = 1; loop_example : loop select concat('index -> ', i); set i = i + 1; if i > 10 then leave loop_example; end if; end loop; end; call p_for_loop();
作者:Nick Huang 博客:http://www.cnblogs.com/nick-huang/
本博客为学习、笔记之用,以笔记形式记录学习的知识与感悟。学习过程中可能参考各种资料,如觉文中表述过分引用,请务必告知,以便迅速处理。如有错漏,不吝赐教。
如果本文对您有用,点赞或评论哦;如果您喜欢我的文章,请点击关注我哦~
本博客为学习、笔记之用,以笔记形式记录学习的知识与感悟。学习过程中可能参考各种资料,如觉文中表述过分引用,请务必告知,以便迅速处理。如有错漏,不吝赐教。
如果本文对您有用,点赞或评论哦;如果您喜欢我的文章,请点击关注我哦~