📄 sp.result
字号:
deterministicbegindeclare continue handler for sqlexceptionselect 'Outer (bad)' as 'h_xs';begin-- integrity constraint violationdeclare continue handler for sqlstate '23000' select 'Inner (good)' as 'h_xs';insert into t3 values (1);end;end|create procedure h_xx()deterministicbegindeclare continue handler for sqlexceptionselect 'Outer (bad)' as 'h_xx';begindeclare continue handler for sqlexceptionselect 'Inner (good)' as 'h_xx';insert into t3 values (1);end;end|call h_ee()|h_eeInner (good)call h_es()|h_esOuter (good)call h_en()|h_enOuter (good)call h_ew()|h_ewOuter (good)call h_ex()|h_exOuter (good)call h_se()|h_seInner (good)call h_ss()|h_ssInner (good)call h_sn()|h_snOuter (good)call h_sw()|h_swOuter (good)call h_sx()|h_sxOuter (good)call h_ne()|h_neInner (good)call h_ns()|h_nsInner (good)call h_nn()|h_nnInner (good)call h_we()|h_weInner (good)call h_ws()|h_wsInner (good)call h_ww()|h_wwInner (good)call h_xe()|h_xeInner (good)call h_xs()|h_xsInner (good)call h_xx()|h_xxInner (good)drop table t3|drop procedure h_ee|drop procedure h_es|drop procedure h_en|drop procedure h_ew|drop procedure h_ex|drop procedure h_se|drop procedure h_ss|drop procedure h_sn|drop procedure h_sw|drop procedure h_sx|drop procedure h_ne|drop procedure h_ns|drop procedure h_nn|drop procedure h_we|drop procedure h_ws|drop procedure h_ww|drop procedure h_xe|drop procedure h_xs|drop procedure h_xx|drop procedure if exists bug822|create procedure bug822(a_id char(16), a_data int)begindeclare n int;select count(*) into n from t1 where id = a_id and data = a_data;if n = 0 theninsert into t1 (id, data) values (a_id, a_data);end if;end|delete from t1|call bug822('foo', 42)|call bug822('foo', 42)|call bug822('bar', 666)|select * from t1|id datafoo 42bar 666delete from t1|drop procedure bug822|drop procedure if exists bug1495|create procedure bug1495()begindeclare x int;select data into x from t1 order by id limit 1;if x > 10 theninsert into t1 values ("less", x-10);elseinsert into t1 values ("more", x+10);end if;end|insert into t1 values ('foo', 12)|call bug1495()|delete from t1 where id='foo'|insert into t1 values ('bar', 7)|call bug1495()|delete from t1 where id='bar'|select * from t1|id dataless 2more 17delete from t1|drop procedure bug1495|drop procedure if exists bug1547|create procedure bug1547(s char(16))begindeclare x int;select data into x from t1 where s = id limit 1;if x > 10 theninsert into t1 values ("less", x-10);elseinsert into t1 values ("more", x+10);end if;end|insert into t1 values ("foo", 12), ("bar", 7)|call bug1547("foo")|call bug1547("bar")|select * from t1|id datafoo 12bar 7less 2more 17delete from t1|drop procedure bug1547|drop table if exists t70|create table t70 (s1 int,s2 int)|insert into t70 values (1,2)|drop procedure if exists bug1656|create procedure bug1656(out p1 int, out p2 int)select * into p1, p1 from t70|call bug1656(@1, @2)|select @1, @2|@1 @22 NULLdrop table t70|drop procedure bug1656|create table t3(a int)|drop procedure if exists bug1862|create procedure bug1862()begininsert into t3 values(2); flush tables;end|call bug1862()|call bug1862()|select * from t3|a22drop table t3|drop procedure bug1862|drop procedure if exists bug1874|create procedure bug1874()begindeclare x int;declare y double;select max(data) into x from t1;insert into t2 values ("max", x, 0);select min(data) into x from t1;insert into t2 values ("min", x, 0);select sum(data) into x from t1;insert into t2 values ("sum", x, 0);select avg(data) into y from t1;insert into t2 values ("avg", 0, y);end|insert into t1 (data) values (3), (1), (5), (9), (4)|call bug1874()|select * from t2|s i dmax 9 0min 1 0sum 22 0avg 0 4.4delete from t1|delete from t2|drop procedure bug1874|drop procedure if exists bug2260|create procedure bug2260()begindeclare v1 int;declare c1 cursor for select data from t1;declare continue handler for not found set @x2 = 1;open c1;fetch c1 into v1;set @x2 = 2;close c1;end|call bug2260()|select @x2|@x22drop procedure bug2260|drop procedure if exists bug2267_1|create procedure bug2267_1()beginshow procedure status;end|drop procedure if exists bug2267_2|create procedure bug2267_2()beginshow function status;end|drop procedure if exists bug2267_3|create procedure bug2267_3()beginshow create procedure bug2267_1;end|drop procedure if exists bug2267_4|drop function if exists bug2267_4|create procedure bug2267_4()beginshow create function bug2267_4;end|create function bug2267_4() returns int return 100|call bug2267_1()|Db Name Type Definer Modified Created Security_type Commenttest bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER test bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER test bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER test bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER call bug2267_2()|Db Name Type Definer Modified Created Security_type Commenttest bug2267_4 FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER call bug2267_3()|Procedure sql_mode Create Procedurebug2267_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug2267_1`()beginshow procedure status;endcall bug2267_4()|Function sql_mode Create Functionbug2267_4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug2267_4`() RETURNS int(11)return 100drop procedure bug2267_1|drop procedure bug2267_2|drop procedure bug2267_3|drop procedure bug2267_4|drop function bug2267_4|drop procedure if exists bug2227|create procedure bug2227(x int)begindeclare y float default 2.6;declare z char(16) default "zzz";select 1.3, x, y, 42, z;end|call bug2227(9)|1.3 x y 42 z1.3 9 2.6 42 zzzdrop procedure bug2227|drop procedure if exists bug2614|create procedure bug2614()begindrop table if exists t3;create table t3 (id int default '0' not null);insert into t3 select 12;insert into t3 select * from t3;end|call bug2614()|call bug2614()|drop table t3|drop procedure bug2614|drop function if exists bug2674|create function bug2674() returns intreturn @@sort_buffer_size|set @osbs = @@sort_buffer_size|set @@sort_buffer_size = 262000|select bug2674()|bug2674()262000drop function bug2674|set @@sort_buffer_size = @osbs|drop procedure if exists bug3259_1 |create procedure bug3259_1 () begin end|drop procedure if exists BUG3259_2 |create procedure BUG3259_2 () begin end|drop procedure if exists Bug3259_3 |create procedure Bug3259_3 () begin end|call BUG3259_1()|call BUG3259_1()|call bug3259_2()|call Bug3259_2()|call bug3259_3()|call bUG3259_3()|drop procedure bUg3259_1|drop procedure BuG3259_2|drop procedure BUG3259_3|drop function if exists bug2772|create function bug2772() returns char(10) character set latin2return 'a'|select bug2772()|bug2772()adrop function bug2772|drop procedure if exists bug2776_1|create procedure bug2776_1(out x int)begindeclare v int;set v = default;set x = v;end|drop procedure if exists bug2776_2|create procedure bug2776_2(out x int)begindeclare v int default 42;set v = default;set x = v;end|set @x = 1|call bug2776_1(@x)|select @x|@xNULLcall bug2776_2(@x)|select @x|@x42drop procedure bug2776_1|drop procedure bug2776_2|create table t3 (s1 smallint)|insert into t3 values (123456789012)|Warnings:Warning 1264 Out of range value adjusted for column 's1' at row 1drop procedure if exists bug2780|create procedure bug2780()begindeclare exit handler for sqlwarning set @x = 1; set @x = 0;insert into t3 values (123456789012);insert into t3 values (0);end|call bug2780()|select @x|@x1select * from t3|s13276732767drop procedure bug2780|drop table t3|create table t3 (content varchar(10) )|insert into t3 values ("test1")|insert into t3 values ("test2")|create table t4 (f1 int, rc int, t3 int)|drop procedure if exists bug1863|create procedure bug1863(in1 int)begin declare ind int default 0;declare t1 int;declare t2 int;declare t3 int;declare rc int default 0;declare continue handler for 1065 set rc = 1;drop temporary table if exists temp_t1;create temporary table temp_t1 (f1 int auto_increment, f2 varchar(20), primary key (f1));insert into temp_t1 (f2) select content from t3;select f2 into t3 from temp_t1 where f1 = 10;if (rc) theninsert into t4 values (1, rc, t3);end if;insert into t4 values (2, rc, t3);end|call bug1863(10)|Warnings:Note 1051 Unknown table 'temp_t1'Warning 1329 No data - zero rows fetched, selected, or processedcall bug1863(10)|Warnings:Warning 1329 No data - zero rows fetched, selected, or processedselect * from t4|f1 rc t32 0 NULL2 0 NULLdrop procedure bug1863|drop temporary table temp_t1;drop table t3, t4|create table t3 ( OrderID int not null,MarketID int,primary key (OrderID))|create table t4 ( MarketID int not null,Market varchar(60),Status char(1),primary key (MarketID))|insert t3 (OrderID,MarketID) values (1,1)|insert t3 (OrderID,MarketID) values (2,2)|insert t4 (MarketID,Market,Status) values (1,"MarketID One","A")|insert t4 (MarketID,Market,Status) values (2,"MarketID Two","A")|drop procedure if exists bug2656_1|create procedure bug2656_1()begin selectm.Marketfrom t4 m JOIN t3 o ON o.MarketID != 1 and o.MarketID = m.MarketID;end |drop procedure if exists bug2656_2|create procedure bug2656_2()begin selectm.Marketfrom t4 m, t3 owhere m.MarketID != 1 and m.MarketID = o.MarketID;end |call bug2656_1()|MarketMarketID Twocall bug2656_1()|MarketMarketID Twocall bug2656_2()|MarketMarketID Twocall bug2656_2()|MarketMarketID Twodrop procedure bug2656_1|drop procedure bug2656_2|drop table t3, t4|drop procedure if exists bug3426|create procedure bug3426(in_time int unsigned, out x int)beginif in_time is null thenset @stamped_time=10;set x=1;elseset @stamped_time=in_time;set x=2;end if;end|call bug3426(1000, @i)|select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|@i time2 01-01-1970 03:16:40call bug3426(NULL, @i)|select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|@i time1 01-01-1970 03:00:10alter procedure bug3426 sql security invoker|call bug3426(NULL, @i)|select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|@i time1 01-01-1970 03:00:10call bug3426(1000, @i)|select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|@i time2 01-01-1970 03:16:40drop procedure bug3426|create table t3 (id int unsigned auto_increment not null primary key,title VARCHAR(200),body text,fulltext (title,body))|insert into t3 (title,body) values('MySQL Tutorial','DBMS stands for DataBase ...'),('How To Use MySQL Well','After you went through a ...'),('Optimizing MySQL','In this tutorial we will show ...'),('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),('MySQL vs. YourSQL','In the following database comparison ...'),('MySQL Security','When configured properly, MySQL ...')|drop procedure if exists bug3734 |create procedure bug3734 (param1 varchar(100))select * from t3 where match (title,body) against (param1)|call bug3734('database')|id title body5 MySQL vs. YourSQL In the following database comparison ...1 MySQL Tutorial DBMS stands for DataBase ...call bug3734('Security')|id title body6 MySQL Security When configured properly, MySQL ...drop procedure bug3734|drop table t3|drop procedure if exists bug3863|create procedure bug3863()beginset @a = 0;while @a < 5 doset @a = @a + 1;end while;end|call bug3863()|select @a|@a5call bug3863()|select @a|@a5drop procedure bug3863|create table t3 (id int(10) unsigned not null default 0,rid int(10) unsigned not null default 0,msg text not null,primary key (id),unique key rid (rid, id))|drop procedure if exists bug2460_1|create procedure bug2460_1(in v int)begin( select n0.id from t3 as n0 where n0.id = v )union( select n0.id from t3 as n0, t3 as n1where n0.id = n1.rid and n1.id = v )union( select n0.id from t3 as n0, t3 as n1, t3 as n2where n0.id = n1.rid and n1.id = n2.rid and n2.id = v );end|call bug2460_1(2)|idcall bug2460_1(2)|idinsert into t3 values (1, 1, 'foo'), (2, 1, 'bar'), (3, 1, 'zip zap')|call bug2460_1(2)|id21call bug2460_1(2)|id21drop procedure if exists bug2460_2|
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -