📄 sp-goto.result
字号:
drop table if exists t1;create table t1 (id char(16) not null default '',data int not null);drop procedure if exists goto1//create procedure goto1()begindeclare y int;label a;select * from t1;select count(*) into y from t1;if y > 2 thengoto b;end if;insert into t1 values ("j", y);goto a;label b;end//call goto1()//id dataid dataj 0id dataj 0j 1id dataj 0j 1j 2drop procedure goto1//drop procedure if exists goto2//create procedure goto2(a int)begindeclare x int default 0;declare continue handler for sqlstate '42S98' set x = 1;label a;select * from t1;b:while x < 2 dobegindeclare continue handler for sqlstate '42S99' set x = 2;if a = 0 thenset x = x + 1;iterate b;elseif a = 1 thenleave b;elseif a = 2 thenset a = 1;goto a;end if;end;end while b;select * from t1;end//call goto2(0)//id dataj 0j 1j 2id dataj 0j 1j 2call goto2(1)//id dataj 0j 1j 2id dataj 0j 1j 2call goto2(2)//id dataj 0j 1j 2id dataj 0j 1j 2id dataj 0j 1j 2drop procedure goto2//delete from t1//drop procedure if exists goto3//create procedure goto3()beginlabel L1;beginend;goto L1;end//drop procedure goto3//drop procedure if exists goto4//create procedure goto4()beginbeginlabel lab1;begingoto lab1;end;end;end//drop procedure goto4//drop procedure if exists goto5//create procedure goto5()beginbeginbegingoto lab1;end;label lab1;end;end//drop procedure goto5//drop procedure if exists goto6//create procedure goto6()beginlabel L1;goto L5;beginlabel L2;goto L1;goto L5;beginlabel L3;goto L1;goto L2;goto L3;goto L4;goto L5;end;goto L2;goto L4;label L4;end;label L5;goto L1;end//drop procedure goto6//create procedure foo()begingoto foo;end//ERROR 42000: GOTO with no matching label: foocreate procedure foo()beginbeginlabel foo;end;goto foo;end//ERROR 42000: GOTO with no matching label: foocreate procedure foo()begingoto foo;beginlabel foo;end;end//ERROR 42000: GOTO with no matching label: foocreate procedure foo()beginbegingoto foo;end;beginlabel foo;end;end//ERROR 42000: GOTO with no matching label: foocreate procedure foo()beginbeginlabel foo;end;begingoto foo;end;end//ERROR 42000: GOTO with no matching label: foocreate procedure p()begindeclare continue handler for sqlexceptionbegingoto L1;end;select field from t1;label L1;end//ERROR HY000: GOTO is not allowed in a stored procedure handlerdrop procedure if exists bug6898//create procedure bug6898()begingoto label1;label label1;begin end;goto label1;end//drop procedure bug6898//drop table t1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -