存储过程只能调用一次,第二次就报错 5C

delimiter $$
create function caculatewage1(wage int) returns int
begin
declare ret int default 0;
if wage>=0 and wage<=4999 then
set ret=0;
elseif wage>=5000 and wage<=7999 then
set ret=(wage-5000)*0.03;
elseif wage>=8000 and wage<=11999 then
set ret=(wags-8000)*0.1+90;
elseif wage>=12000 and wage<=29999 then
set ret=(wags-12000)*0.25+400+90;
else
set ret=(wage-30000)*0.4+4500+400+90;
end if;
return ret;
end$$
delimiter ;

delimiter $$
create procedure caculate(in wage int)
begin
declare fund,social,wage1 int default 0;
declare tax int;
set tax=caculatewage1(wage);
set fund=wage*0.08;
set social=wage*0.05;
set wage1=wage-tax;
insert into wages(wages,housing_fund,social_insurance,tax,realwage) values(wage,fund,social,tax,wage1);
end$$
delimiter ;

 上面是存储函数,下面是存储过程,在这个存储过程里调用存储函数

1个回答

解决了,,,,,,,,,,,,,,,,,程序员得细心 不然

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!