sp-error.result 12 KB
Newer Older
1
delete from mysql.proc;
unknown's avatar
unknown committed
2
create procedure syntaxerror(t int)|
unknown's avatar
unknown committed
3
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
unknown's avatar
unknown committed
4
create procedure syntaxerror(t int)|
unknown's avatar
unknown committed
5
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
unknown's avatar
unknown committed
6
create procedure syntaxerror(t int)|
unknown's avatar
unknown committed
7
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
8 9 10 11 12 13 14 15 16
drop table if exists t3|
create table t3 ( x int )|
insert into t3 values (2), (3)|
create procedure bad_into(out param int)
select x from t3 into param|
call bad_into(@x)|
ERROR 42000: Result consisted of more than one row
drop procedure bad_into|
drop table t3|
17
create procedure proc1()
unknown's avatar
unknown committed
18
set @x = 42|
19
create function func1() returns int
unknown's avatar
unknown committed
20
return 42|
21
create procedure foo()
unknown's avatar
unknown committed
22
create procedure bar() set @x=3|
23
ERROR 2F003: Can't create a PROCEDURE from within another stored routine
24
create procedure foo()
unknown's avatar
unknown committed
25
create function bar() returns double return 2.3|
26
ERROR 2F003: Can't create a FUNCTION from within another stored routine
27
create procedure proc1()
unknown's avatar
unknown committed
28
set @x = 42|
29
ERROR 42000: PROCEDURE proc1 already exists
30
create function func1() returns int
unknown's avatar
unknown committed
31
return 42|
32
ERROR 42000: FUNCTION func1 already exists
unknown's avatar
unknown committed
33 34 35
drop procedure proc1|
drop function func1|
alter procedure foo|
36
ERROR 42000: PROCEDURE test.foo does not exist
unknown's avatar
unknown committed
37
alter function foo|
38
ERROR 42000: FUNCTION test.foo does not exist
unknown's avatar
unknown committed
39
drop procedure foo|
40
ERROR 42000: PROCEDURE test.foo does not exist
unknown's avatar
unknown committed
41
drop function foo|
42
ERROR 42000: FUNCTION test.foo does not exist
unknown's avatar
unknown committed
43
call foo()|
44
ERROR 42000: PROCEDURE test.foo does not exist
unknown's avatar
unknown committed
45
drop procedure if exists foo|
46
Warnings:
47
Note	1305	PROCEDURE foo does not exist
unknown's avatar
unknown committed
48
show create procedure foo|
49
ERROR 42000: PROCEDURE foo does not exist
50 51
show create function foo|
ERROR 42000: FUNCTION foo does not exist
52 53 54
create procedure foo()
foo: loop
leave bar;
unknown's avatar
unknown committed
55
end loop|
56
ERROR 42000: LEAVE with no matching label: bar
57 58 59
create procedure foo()
foo: loop
iterate bar;
unknown's avatar
unknown committed
60
end loop|
61
ERROR 42000: ITERATE with no matching label: bar
62
create procedure foo()
unknown's avatar
unknown committed
63 64
foo: begin
iterate foo;
unknown's avatar
unknown committed
65
end|
66
ERROR 42000: ITERATE with no matching label: foo
unknown's avatar
unknown committed
67
create procedure foo()
68 69 70 71 72
begin
goto foo;
end|
ERROR 42000: GOTO with no matching label: foo
create procedure foo()
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
begin
begin
label foo;
end;
goto foo;
end|
ERROR 42000: GOTO with no matching label: foo
create procedure foo()
begin
goto foo;
begin
label foo;
end;
end|
ERROR 42000: GOTO with no matching label: foo
create procedure foo()
begin
begin
goto foo;
end;
begin
label foo;
end;
end|
ERROR 42000: GOTO with no matching label: foo
create procedure foo()
begin
begin
label foo;
end;
begin
goto foo;
end;
end|
ERROR 42000: GOTO with no matching label: foo
create procedure foo()
109 110 111 112
foo: loop
foo: loop
set @x=2;
end loop foo;
unknown's avatar
unknown committed
113
end loop foo|
114
ERROR 42000: Redefining label foo
115 116 117
create procedure foo()
foo: loop
set @x=2;
unknown's avatar
unknown committed
118
end loop bar|
119
ERROR 42000: End-label bar without match
120
create procedure foo()
unknown's avatar
unknown committed
121
return 42|
122
ERROR 42000: RETURN is only allowed in a FUNCTION
unknown's avatar
unknown committed
123
create procedure p(x int)
124
set @x = x|
unknown's avatar
unknown committed
125
create function f(x int) returns int
unknown's avatar
unknown committed
126 127
return x+42|
call p()|
unknown's avatar
unknown committed
128
ERROR 42000: Incorrect number of arguments for PROCEDURE p; expected 1, got 0
unknown's avatar
unknown committed
129
call p(1, 2)|
unknown's avatar
unknown committed
130
ERROR 42000: Incorrect number of arguments for PROCEDURE p; expected 1, got 2
unknown's avatar
unknown committed
131
select f()|
unknown's avatar
unknown committed
132
ERROR 42000: Incorrect number of arguments for FUNCTION f; expected 1, got 0
unknown's avatar
unknown committed
133
select f(1, 2)|
unknown's avatar
unknown committed
134
ERROR 42000: Incorrect number of arguments for FUNCTION f; expected 1, got 2
unknown's avatar
unknown committed
135 136
drop procedure p|
drop function f|
137 138 139 140 141 142 143 144 145 146
create procedure p(val int, out res int)
begin
declare x int default 0;
declare continue handler for foo set x = 1;
insert into test.t1 values (val);
if (x) then
set res = 0;
else
set res = 1;
end if;
unknown's avatar
unknown committed
147
end|
148
ERROR 42000: Undefined CONDITION: foo
149 150 151 152 153 154 155 156 157 158 159
create procedure p(val int, out res int)
begin
declare x int default 0;
declare foo condition for 1146;
declare continue handler for bar set x = 1;
insert into test.t1 values (val);
if (x) then
set res = 0;
else
set res = 1;
end if;
unknown's avatar
unknown committed
160
end|
161
ERROR 42000: Undefined CONDITION: bar
162 163 164 165
create function f(val int) returns int
begin
declare x int;
set x = val+3;
unknown's avatar
unknown committed
166
end|
167
ERROR 42000: No RETURN found in FUNCTION f
168 169 170 171 172 173 174
create function f(val int) returns int
begin
declare x int;
set x = val+3;
if x < 4 then
return x;
end if;
unknown's avatar
unknown committed
175 176
end|
select f(10)|
177
ERROR 2F005: FUNCTION f ended without RETURN
unknown's avatar
unknown committed
178
drop function f|
179 180 181 182 183
create procedure p()
begin
declare c cursor for insert into test.t1 values ("foo", 42);
open c;
close c;
unknown's avatar
unknown committed
184
end|
185
ERROR 42000: Cursor statement must be a SELECT
186 187 188 189 190 191
create procedure p()
begin
declare x int;
declare c cursor for select * into x from test.t limit 1;
open c;
close c;
unknown's avatar
unknown committed
192
end|
193
ERROR 42000: Cursor SELECT must not have INTO
194 195 196 197 198
create procedure p()
begin
declare c cursor for select * from test.t;
open cc;
close c;
unknown's avatar
unknown committed
199
end|
200
ERROR 42000: Undefined CURSOR: cc
unknown's avatar
unknown committed
201 202
drop table if exists t1|
create table t1 (val int)|
203 204 205 206 207 208
create procedure p()
begin
declare c cursor for select * from test.t1;
open c;
open c;
close c;
unknown's avatar
unknown committed
209 210
end|
call p()|
211
ERROR 24000: Cursor is already open
unknown's avatar
unknown committed
212
drop procedure p|
213 214 215 216 217 218
create procedure p()
begin
declare c cursor for select * from test.t1;
open c;
close c;
close c;
unknown's avatar
unknown committed
219 220
end|
call p()|
221
ERROR 24000: Cursor is not open
unknown's avatar
unknown committed
222 223
drop procedure p|
alter procedure bar3 sql security invoker|
224
ERROR 42000: PROCEDURE test.bar3 does not exist
unknown's avatar
unknown committed
225 226 227 228
drop table t1|
drop table if exists t1|
create table t1 (val int, x float)|
insert into t1 values (42, 3.1), (19, 1.2)|
229 230 231
create procedure p()
begin
declare x int;
232
declare c cursor for select * from t1;
233 234 235
open c;
fetch c into x, y;
close c;
unknown's avatar
unknown committed
236
end|
237
ERROR 42000: Undeclared variable: y
238 239 240
create procedure p()
begin
declare x int;
241
declare c cursor for select * from t1;
242 243 244
open c;
fetch c into x;
close c;
unknown's avatar
unknown committed
245 246
end|
call p()|
unknown's avatar
unknown committed
247
ERROR HY000: Incorrect number of FETCH variables
unknown's avatar
unknown committed
248
drop procedure p|
249 250 251 252 253
create procedure p()
begin
declare x int;
declare y float;
declare z int;
254
declare c cursor for select * from t1;
255 256 257
open c;
fetch c into x, y, z;
close c;
unknown's avatar
unknown committed
258 259
end|
call p()|
unknown's avatar
unknown committed
260
ERROR HY000: Incorrect number of FETCH variables
unknown's avatar
unknown committed
261
drop procedure p|
unknown's avatar
unknown committed
262 263
create procedure p(in x int, x char(10))
begin
unknown's avatar
unknown committed
264
end|
265
ERROR 42000: Duplicate parameter: x
unknown's avatar
unknown committed
266 267
create function p(x int, x char(10))
begin
unknown's avatar
unknown committed
268
end|
269
ERROR 42000: Duplicate parameter: x
unknown's avatar
unknown committed
270 271 272 273
create procedure p()
begin
declare x float;
declare x int;
unknown's avatar
unknown committed
274
end|
275
ERROR 42000: Duplicate variable: x
unknown's avatar
unknown committed
276 277 278 279
create procedure p()
begin
declare c condition for 1064;
declare c condition for 1065;
unknown's avatar
unknown committed
280
end|
281
ERROR 42000: Duplicate condition: c
unknown's avatar
unknown committed
282 283 284 285
create procedure p()
begin
declare c cursor for select * from t1;
declare c cursor for select field from t1;
unknown's avatar
unknown committed
286
end|
287
ERROR 42000: Duplicate cursor: c
288
create procedure u()
289
use sptmp|
290
ERROR 42000: USE is not allowed in a stored procedure
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
create procedure p()
begin
declare c cursor for select * from t1;
declare x int;
end|
ERROR 42000: Variable or condition declaration after cursor or handler declaration
create procedure p()
begin
declare x int;
declare continue handler for sqlstate '42S99' set x = 1;
declare foo condition for sqlstate '42S99';
end|
ERROR 42000: Variable or condition declaration after cursor or handler declaration
create procedure p()
begin
declare x int;
declare continue handler for sqlstate '42S99' set x = 1;
declare c cursor for select * from t1;
end|
ERROR 42000: Cursor declaration after handler declaration
311 312 313 314 315 316 317 318 319 320
create procedure p()
begin
declare continue handler for sqlexception
begin
goto L1;
end;
select field from t1;
label L1;
end|
ERROR HY000: GOTO is not allowed in a stored procedure handler
321 322 323 324 325
create procedure bug1965()
begin
declare c cursor for select val from t1 order by valname;
open c;
close c;
unknown's avatar
unknown committed
326 327
end|
call bug1965()|
328
ERROR 42S22: Unknown column 'valname' in 'order clause'
unknown's avatar
unknown committed
329 330
drop procedure bug1965|
select 1 into a|
331
ERROR 42000: Undeclared variable: a
332
drop table if exists t3|
unknown's avatar
unknown committed
333
create table t3 (column_1_0 int)|
334
create procedure bug1653()
unknown's avatar
unknown committed
335 336
update t3 set column_1 = 0|
call bug1653()|
337
ERROR 42S22: Unknown column 'column_1' in 'field list'
unknown's avatar
unknown committed
338 339 340 341 342
drop table t3|
create table t3 (column_1 int)|
call bug1653()|
drop procedure bug1653|
drop table t3|
343 344 345
create procedure bug2259()
begin
declare v1 int;
346
declare c1 cursor for select s1 from t1;
347 348 349 350 351
fetch c1 into v1;
end|
call bug2259()|
ERROR 24000: Cursor is not open
drop procedure bug2259|
352 353 354 355 356 357 358 359 360
create procedure bug2272()
begin
declare v int;
update t1 set v = 42;
end|
insert into t1 values (666, 51.3)|
call bug2272()|
ERROR 42S22: Unknown column 'v' in 'field list'
delete from t1|
361
drop procedure bug2272|
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
create procedure bug2329_1()
begin
declare v int;
insert into t1 (v) values (5);
end|
create procedure bug2329_2()
begin
declare v int;
replace t1 set v = 5;
end|
call bug2329_1()|
ERROR 42S22: Unknown column 'v' in 'field list'
call bug2329_2()|
ERROR 42S22: Unknown column 'v' in 'field list'
drop procedure bug2329_1|
drop procedure bug2329_2|
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398
create function bug3287() returns int
begin
declare v int default null;
case
when v is not null then return 1;
end case;
return 2;
end|
select bug3287()|
ERROR 20000: Case not found for CASE statement
drop function bug3287|
create procedure bug3287(x int)
case x
when 0 then
insert into test.t1 values (x, 0.1);
when 1 then
insert into test.t1 values (x, 1.1);
end case|
call bug3287(2)|
ERROR 20000: Case not found for CASE statement
drop procedure bug3287|
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
drop table if exists t3|
create table t3 (s1 int, primary key (s1))|
insert into t3 values (5),(6)|
create procedure bug3279(out y int) 
begin
declare x int default 0;
begin
declare exit handler for sqlexception set x = x+1;
insert into t3 values (5);
end;
if x < 2 then
set x = x+1;
insert into t3 values (6);
end if;
set y = x;
end|
set @x = 0|
call bug3279(@x)|
ERROR 23000: Duplicate entry '6' for key 1
select @x|
@x
0
drop procedure bug3279|
drop table t3|
423 424
create procedure nodb.bug3339() begin end|
ERROR 42000: Unknown database 'nodb'
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
create procedure bug2653_1(a int, out b int)
set b = aa|
create procedure bug2653_2(a int, out b int)
begin
if aa < 0 then
set b = - a;
else
set b = a;
end if;
end|
call bug2653_1(1, @b)|
ERROR 42S22: Unknown column 'aa' in 'order clause'
call bug2653_2(2, @b)|
ERROR 42S22: Unknown column 'aa' in 'order clause'
drop procedure bug2653_1|
drop procedure bug2653_2|
441 442 443 444
create procedure bug4344() drop procedure bug4344|
ERROR HY000: Can't drop a PROCEDURE from within another stored routine
create procedure bug4344() drop function bug4344|
ERROR HY000: Can't drop a FUNCTION from within another stored routine
445 446 447 448 449
drop procedure if exists bug3294|
create procedure bug3294()
begin
declare continue handler for sqlexception drop table t5;
drop table t5;
450
drop table t5;
451
end|
452
create table t5 (x int)|
453 454 455
call bug3294()|
ERROR 42S02: Unknown table 't5'
drop procedure bug3294|
456 457 458 459 460 461 462 463 464 465 466 467 468
drop procedure if exists bug6807|
create procedure bug6807()
begin
declare id int;
set id = connection_id();
kill query id;
select 'Not reached';
end|
call bug6807()|
ERROR 70100: Query execution was interrupted
call bug6807()|
ERROR 70100: Query execution was interrupted
drop procedure bug6807|
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
drop procedure if exists bug8776_1|
drop procedure if exists bug8776_2|
drop procedure if exists bug8776_3|
drop procedure if exists bug8776_4|
create procedure bug8776_1()
begin
declare continue handler for sqlstate '42S0200test' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '42S0200test'
create procedure bug8776_2()
begin
declare continue handler for sqlstate '4200' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '4200'
create procedure bug8776_3()
begin
declare continue handler for sqlstate '420000' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '420000'
create procedure bug8776_4()
begin
declare continue handler for sqlstate '42x00' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '42x00'
497 498 499 500 501 502 503 504 505
create procedure bug6600()
check table t1|
ERROR 0A000: CHECK is not allowed in stored procedures
create procedure bug6600()
lock table t1 read|
ERROR 0A000: LOCK is not allowed in stored procedures
create procedure bug6600()
unlock table t1|
ERROR 0A000: UNLOCK is not allowed in stored procedures
506 507 508 509 510 511 512 513 514 515
drop procedure if exists bug9566|
create procedure bug9566()
begin
select * from t1;
end|
lock table t1 read|
call bug9566()|
ERROR HY000: Table 'proc' was not locked with LOCK TABLES
unlock tables|
drop procedure bug9566|
unknown's avatar
unknown committed
516
drop table t1|