题目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加),几个数相加有键盘控制
drop PROCEDURE if exists test;
create PROCEDURE test ( a int ,n int )
begin
declare s ,t int;
set s=0;
set t=a;
REPEAT
set s=s+t;
set a=a*10;
set t=t+a;
set n=n-1;
UNTIL n=0
end REPEAT;
select s;
end;