3、定义一个过程main
作者:互联网
delimiter $$
drop procedure if exists main;
create procedure main()
begin
declare x varchar(100);
declare xing,ming,xm varchar(3);
declare sex,n int;
declare xh varchar(8);
set xh='19000';
drop table if exists xs1;
create table xs1 as select 学号,姓名,性别 from xs;
delete from xs1;
set x='刘王张赵李钱朱何孙曾陈吴黄郑邓周毛江胡';
set n=1;
while n<21 do
call get_a_character(x,xing);
call get_name(ming,sex);
set xm=concat((select xing),(select ming));
select xm;
insert into xs1 values ((select xh),(select xm),sex);
set xh=xh+1;
set n=n+1;
end while;
end $$
delimiter ;
call main();
select * from xs1;
标签:xh,set,定义,xm,xs1,main,过程,select 来源: https://blog.csdn.net/LLF_CEsx/article/details/117602741