| 1 |
drop table if exists t1; |
| 2 |
create table t1 ( |
| 3 |
a int not null primary key, |
| 4 |
b int not null |
| 5 |
) engine=ndb; |
| 6 |
insert into t1 values (1,10), (2,20), (3,100), (4, 100); |
| 7 |
create procedure test_proc1 (in var_in int) |
| 8 |
begin |
| 9 |
select * from t1 where a = var_in; |
| 10 |
end; |
| 11 |
create procedure test_proc2 (out var_out int) |
| 12 |
begin |
| 13 |
select b from t1 where a = 1 into var_out; |
| 14 |
end; |
| 15 |
create procedure test_proc3 (inout var_inout int) |
| 16 |
begin |
| 17 |
select b from t1 where a = var_inout into var_inout; |
| 18 |
end; |
| 19 |
// |
| 20 |
call test_proc1(1); |
| 21 |
a b |
| 22 |
1 10 |
| 23 |
call test_proc2(@test_var); |
| 24 |
select @test_var; |
| 25 |
@test_var |
| 26 |
10 |
| 27 |
set @test_var = 1; |
| 28 |
call test_proc3(@test_var); |
| 29 |
select @test_var; |
| 30 |
@test_var |
| 31 |
10 |
| 32 |
alter procedure test_proc1 comment 'new comment'; |
| 33 |
show create procedure test_proc1; |
| 34 |
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation |
| 35 |
test_proc1 ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `test_proc1`(in var_in int) |
| 36 |
COMMENT 'new comment' |
| 37 |
begin |
| 38 |
select * from t1 where a = var_in; |
| 39 |
end utf8mb4 utf8mb4_0900_ai_ci utf8mb4_0900_ai_ci |
| 40 |
drop procedure test_proc1; |
| 41 |
drop procedure test_proc2; |
| 42 |
drop procedure test_proc3; |
| 43 |
drop table t1; |
| 44 |
End of 5.1 tests |