ITPub博客

首页 > Linux操作系统 > Linux操作系统 > mysql procedure 中 repeat &cursor 的用法。

mysql procedure 中 repeat &cursor 的用法。

原创 Linux操作系统 作者:season0891 时间:2008-08-28 16:28:19 0 删除 编辑

delimiter //;

create procedure p1()
begin
declare a varchar(20);
declare b int;
declare cur1 cursor for select user from mysql.user;
declare continue handler for not found set b=1;
open cur1;
repeat
begin
  fetch cur1 into a;
  select a;
end;
until b=1
end repeat;
close cur1;
select b;
end;//

delimiter ;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/90618/viewspace-438677/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-06-10

  • 博文量
    790
  • 访问量
    2098008