⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp.result

📁 这是linux下运行的mysql软件包,可用于linux 下安装 php + mysql + apach 的网络配置
💻 RESULT
📖 第 1 页 / 共 5 页
字号:
use test;drop table if exists t1,t2,t3,t4;create table t1 (id   char(16) not null default '',data int not null);create table t2 (s   char(16),i   int,d   double);drop procedure if exists foo42;create procedure foo42()insert into test.t1 values ("foo", 42);call foo42();select * from t1;id	datafoo	42delete from t1;drop procedure foo42;drop procedure if exists bar;create procedure bar(x char(16), y int)insert into test.t1 values (x, y);call bar("bar", 666);select * from t1;id	databar	666delete from t1;drop procedure if exists empty|create procedure empty()beginend|call empty()|drop procedure empty|drop procedure if exists scope|create procedure scope(a int, b float)begindeclare b int;declare c float;begindeclare c int;end;end|drop procedure scope|drop procedure if exists two|create procedure two(x1 char(16), x2 char(16), y int)begininsert into test.t1 values (x1, y);insert into test.t1 values (x2, y);end|call two("one", "two", 3)|select * from t1|id	dataone	3two	3delete from t1|drop procedure two|drop procedure if exists locset|create procedure locset(x char(16), y int)begindeclare z1, z2 int;set z1 = y;set z2 = z1+2;insert into test.t1 values (x, z2);end|call locset("locset", 19)|select * from t1|id	datalocset	21delete from t1|drop procedure locset|drop procedure if exists setcontext|create procedure setcontext()begindeclare data int default 2;insert into t1 (id, data) values ("foo", 1);replace t1 set data = data, id = "bar";update t1 set id = "kaka", data = 3 where t1.data = data;end|call setcontext()|select * from t1|id	datafoo	1kaka	3delete from t1|drop procedure setcontext|create table t3 ( d date, i int, f double, s varchar(32) )|drop procedure if exists nullset|create procedure nullset()begindeclare ld date;declare li int;declare lf double;declare ls varchar(32);set ld = null, li = null, lf = null, ls = null;insert into t3 values (ld, li, lf, ls);insert into t3 (i, f, s) values ((ld is null), 1,    "ld is null"),((li is null), 1,    "li is null"),((li = 0),     null, "li = 0"),((lf is null), 1,    "lf is null"),((lf = 0),     null, "lf = 0"),((ls is null), 1,    "ls is null");end|call nullset()|select * from t3|d	i	f	sNULL	NULL	NULL	NULLNULL	1	1	ld is nullNULL	1	1	li is nullNULL	NULL	NULL	li = 0NULL	1	1	lf is nullNULL	NULL	NULL	lf = 0NULL	1	1	ls is nulldrop table t3|drop procedure nullset|drop procedure if exists mixset|create procedure mixset(x char(16), y int)begindeclare z int;set @z = y, z = 666, max_join_size = 100;insert into test.t1 values (x, z);end|call mixset("mixset", 19)|show variables like 'max_join_size'|Variable_name	Valuemax_join_size	100select id,data,@z from t1|id	data	@zmixset	666	19delete from t1|drop procedure mixset|drop procedure if exists zip|create procedure zip(x char(16), y int)begindeclare z int;call zap(y, z);call bar(x, z);end|drop procedure if exists zap|create procedure zap(x int, out y int)begindeclare z int;set z = x+1, y = z;end|call zip("zip", 99)|select * from t1|id	datazip	100delete from t1|drop procedure zip|drop procedure bar|call zap(7, @zap)|select @zap|@zap8drop procedure zap|drop procedure if exists c1|create procedure c1(x int)call c2("c", x)|drop procedure if exists c2|create procedure c2(s char(16), x int)call c3(x, s)|drop procedure if exists c3|create procedure c3(x int, s char(16))call c4("level", x, s)|drop procedure if exists c4|create procedure c4(l char(8), x int, s char(16))insert into t1 values (concat(l,s), x)|call c1(42)|select * from t1|id	datalevelc	42delete from t1|drop procedure c1|drop procedure c2|drop procedure c3|drop procedure c4|drop procedure if exists iotest|create procedure iotest(x1 char(16), x2 char(16), y int)begincall inc2(x2, y);insert into test.t1 values (x1, y);end|drop procedure if exists inc2|create procedure inc2(x char(16), y int)begincall inc(y);insert into test.t1 values (x, y);end|drop procedure if exists inc|create procedure inc(inout io int)set io = io + 1|call iotest("io1", "io2", 1)|select * from t1|id	dataio2	2io1	1delete from t1|drop procedure iotest|drop procedure inc2|drop procedure if exists incr|create procedure incr(inout x int)call inc(x)|select @zap|@zap8call incr(@zap)|select @zap|@zap9drop procedure inc|drop procedure incr|drop procedure if exists cbv1|create procedure cbv1()begindeclare y int default 3;call cbv2(y+1, y);insert into test.t1 values ("cbv1", y);end|drop procedure if exists cbv2|create procedure cbv2(y1 int, inout y2 int)beginset y2 = 4711;insert into test.t1 values ("cbv2", y1);end|call cbv1()|select * from t1|id	datacbv2	4cbv1	4711delete from t1|drop procedure cbv1|drop procedure cbv2|insert into t2 values ("a", 1, 1.1), ("b", 2, 1.2), ("c", 3, 1.3)|drop procedure if exists sub1|create procedure sub1(id char(16), x int)insert into test.t1 values (id, x)|drop procedure if exists sub2|create procedure sub2(id char(16))begindeclare x int;set x = (select sum(t.i) from test.t2 t);insert into test.t1 values (id, x);end|drop procedure if exists sub3|create function sub3(i int) returns intreturn i+1|call sub1("sub1a", (select 7))|call sub1("sub1b", (select max(i) from t2))|call sub1("sub1c", (select i,d from t2 limit 1))|ERROR 21000: Operand should contain 1 column(s)call sub1("sub1d", (select 1 from (select 1) a))|call sub2("sub2")|select * from t1|id	datasub1a	7sub1b	3sub1d	1sub2	6select sub3((select max(i) from t2))|sub3((select max(i) from t2))4drop procedure sub1|drop procedure sub2|drop function sub3|delete from t1|delete from t2|drop procedure if exists a0|create procedure a0(x int)while x doset x = x-1;insert into test.t1 values ("a0", x);end while|call a0(3)|select * from t1|id	dataa0	2a0	1a0	0delete from t1|drop procedure a0|drop procedure if exists a|create procedure a(x int)while x > 0 doset x = x-1;insert into test.t1 values ("a", x);end while|call a(3)|select * from t1|id	dataa	2a	1a	0delete from t1|drop procedure a|drop procedure if exists b|create procedure b(x int)repeatinsert into test.t1 values (repeat("b",3), x);set x = x-1;until x = 0 end repeat|call b(3)|select * from t1|id	databbb	3bbb	2bbb	1delete from t1|drop procedure b|drop procedure if exists b2|create procedure b2(x int)repeat(select 1 into outfile 'b2');insert into test.t1 values (repeat("b2",3), x);set x = x-1;until x = 0 end repeat|drop procedure b2|drop procedure if exists c|create procedure c(x int)hmm: while x > 0 doinsert into test.t1 values ("c", x);set x = x-1;iterate hmm;insert into test.t1 values ("x", x);end while hmm|call c(3)|select * from t1|id	datac	3c	2c	1delete from t1|drop procedure c|drop procedure if exists d|create procedure d(x int)hmm: while x > 0 doinsert into test.t1 values ("d", x);set x = x-1;leave hmm;insert into test.t1 values ("x", x);end while|call d(3)|select * from t1|id	datad	3delete from t1|drop procedure d|drop procedure if exists e|create procedure e(x int)foo: loopif x = 0 thenleave foo;end if;insert into test.t1 values ("e", x);set x = x-1;end loop foo|call e(3)|select * from t1|id	datae	3e	2e	1delete from t1|drop procedure e|drop procedure if exists f|create procedure f(x int)if x < 0 theninsert into test.t1 values ("f", 0);elseif x = 0 theninsert into test.t1 values ("f", 1);elseinsert into test.t1 values ("f", 2);end if|call f(-2)|call f(0)|call f(4)|select * from t1|id	dataf	0f	1f	2delete from t1|drop procedure f|drop procedure if exists g|create procedure g(x int)casewhen x < 0 theninsert into test.t1 values ("g", 0);when x = 0 theninsert into test.t1 values ("g", 1);elseinsert into test.t1 values ("g", 2);end case|call g(-42)|call g(0)|call g(1)|select * from t1|id	datag	0g	1g	2delete from t1|drop procedure g|drop procedure if exists h|create procedure h(x int)case xwhen 0 theninsert into test.t1 values ("h0", x);when 1 theninsert into test.t1 values ("h1", x);elseinsert into test.t1 values ("h?", x);end case|call h(0)|call h(1)|call h(17)|select * from t1|id	datah0	0h1	1h?	17delete from t1|drop procedure h|drop procedure if exists i|create procedure i(x int)foo:beginif x = 0 thenleave foo;end if;insert into test.t1 values ("i", x);end foo|call i(0)|call i(3)|select * from t1|id	datai	3delete from t1|drop procedure i|insert into t1 values ("foo", 3), ("bar", 19)|insert into t2 values ("x", 9, 4.1), ("y", -1, 19.2), ("z", 3, 2.2)|drop procedure if exists sel1|create procedure sel1()beginselect * from t1;end|call sel1()|id	datafoo	3bar	19drop procedure sel1|drop procedure if exists sel2|create procedure sel2()beginselect * from t1;select * from t2;end|call sel2()|id	datafoo	3bar	19s	i	dx	9	4.1y	-1	19.2z	3	2.2drop procedure sel2|delete from t1|delete from t2|drop procedure if exists into_test|create procedure into_test(x char(16), y int)begininsert into test.t1 values (x, y);select id,data into x,y from test.t1 limit 1;insert into test.t1 values (concat(x, "2"), y+2);end|call into_test("into", 100)|select * from t1|id	datainto	100into2	102delete from t1|drop procedure into_test|drop procedure if exists into_tes2|create procedure into_test2(x char(16), y int)begininsert into test.t1 values (x, y);select id,data into x,@z from test.t1 limit 1;insert into test.t1 values (concat(x, "2"), y+2);end|call into_test2("into", 100)|select id,data,@z from t1|id	data	@zinto	100	100into2	102	100delete from t1|drop procedure into_test2|drop procedure if exists into_test3|create procedure into_test3()begindeclare x char(16);declare y int;select * into x,y from test.t1 limit 1;insert into test.t2 values (x, y, 0.0);end|insert into t1 values ("into3", 19)|call into_test3()|call into_test3()|select * from t2|s	i	dinto3	19	0into3	19	0delete from t1|delete from t2|drop procedure into_test3|drop procedure if exists into_test4|create procedure into_test4()begindeclare x int;select data into x from test.t1 limit 1;insert into test.t3 values ("into4", x);end|delete from t1|create table t3 ( s char(16), d int)|call into_test4()|Warnings:Warning	1329	No data - zero rows fetched, selected, or processedselect * from t3|s	dinto4	NULLinsert into t1 values ("i4", 77)|call into_test4()|select * from t3|s	dinto4	NULLinto4	77delete from t1|drop table t3|drop procedure into_test4|drop procedure if exists into_outfile|create procedure into_outfile(x char(16), y int)begininsert into test.t1 values (x, y);select * into outfile "../tmp/spout" from test.t1;insert into test.t1 values (concat(x, "2"), y+2);end|call into_outfile("ofile", 1)|delete from t1|drop procedure into_outfile|drop procedure if exists into_dumpfile|create procedure into_dumpfile(x char(16), y int)begininsert into test.t1 values (x, y);select * into dumpfile "../tmp/spdump" from test.t1 limit 1;insert into test.t1 values (concat(x, "2"), y+2);end|call into_dumpfile("dfile", 1)|delete from t1|drop procedure into_dumpfile|drop procedure if exists create_select|create procedure create_select(x char(16), y int)begininsert into test.t1 values (x, y);create temporary table test.t3 select * from test.t1;insert into test.t3 values (concat(x, "2"), y+2);end|call create_select("cs", 90)|select * from t1, t3|id	data	id	datacs	90	cs	90

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -