create PROCEDURE ut()
begin
declare _done int default 0;
declare _id bigint;
declare _type tinyint;
declare cur cursor for select gn_number from groupnumber;
declare continue handler for not found set _done = 1;
open cur;
repeat
fetch cur into _id;
if not _done then
select ai_type into _type from alcoholinfo where ai_number=_id limit 1;
update groupnumber set gn_alcoholtype=_type where gn_number=_id;
end if;
until _done end repeat;
close cur;
end;
call ut();
drop PROCEDURE ut;