mysql procedure 中 repeat &cursor 的用法。

season0891發表於2008-08-28

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部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-438677/,如需轉載,請註明出處,否則將追究法律責任。

相關文章