1
drop table if exists t1;
2
drop table if exists t2;
4
a int not null primary key,
8
a int not null primary key,
11
insert into t1 values (1,10), (2,20), (3,30), (4, 40);
12
create procedure test_cursor ()
14
declare done int default 0;
17
declare cur1 cursor for select a,b from t1;
18
declare continue handler for sqlstate '02000' set done = 1;
21
fetch cur1 into temp_a, temp_b;
23
insert into t2 values (temp_a, temp_b);
25
until done end repeat;
29
select * from t2 order by a;
32
select * from t2 order by a;
38
drop procedure test_cursor;