delimiter //
drop procedure if exists `test` //
CREATE PROCEDURE `test`() comment '测试存储过程'
BEGIN
declare a varchar(255);
declare i int(1) default 0;
DECLARE cur CURSOR FOR select tname from `test`;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION ,NOT FOUND
rollback;
start transaction;
OPEN cur;
while i<12 do
FETCH cur INTO a;
insert into `test` (tname) values (a);
set @ret=row_count();
if @ret<=0 then
rollback;
end if;
set i=i+1;
end while;
close cur;
commit;
end //
delimiter ;
call test();
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。