22,209
社区成员
发帖
与我相关
我的任务
分享
BEGIN
declare v_err_param varchar(1024);
DECLARE V_ERR_NO INT DEFAULT 0;
declare v_sp_name varchar(64) default '';
declare v_row int;
declare v_done int DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET V_ERR_NO=1;
SET V_ERR_NO=-1;
set v_sp_name='xxxxx';
sp_context:begin
start transaction;
INSERT INTO tttb1 (is_ok) VALUES ('ok1-1');
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
if '0000'=p_bfflag then
call sp_2();
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
if 1=1 THEN
zcbfloop: LOOP
INSERT INTO tttb3 (is_ok) VALUES ('ok3-1');
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
begin
INSERT INTO tttb1 (is_ok) VALUES ('ok1-2');
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
loop_room:loop
call sp_2();
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
end loop;
end;
set v_done=0;
end loop;
ELSE
tkloop: LOOP
INSERT INTO tttb3 (is_ok) VALUES ('ok3-2');
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
set v_done=0;
end loop;
end if;
INSERT INTO tttb1 (is_ok) VALUES ('ok1-3');
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
ELSE
call sp_2();
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
end if;
INSERT INTO tttb3 (is_ok) VALUES ('ok3-3');
if V_ERR_NO=1 THEN
set v_row=159;
leave sp_context;
end if;
commit;
end sp_context;
if V_ERR_NO=1 THEN
rollback;
end if;
END