这是我得到的错误,无法找到我错的地方 任何帮助将受到高度赞赏 感谢,
SQL查询:
CREATE PROCEDURE yearly_income_tax_calculation_federal( ) BEGIN DECLARE salary FLOAT;
MySQL说:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5
过程:
create procedure yearly_income_tax_calculation_federal()
begin
declare salary float;
declare tax float;
SELECT salary_annually INTO salary FROM ndcga776_payroll_db.payroll WHERE payroll_id=2;
IF (salary>0 AND salary<=44701) THEN SET tax = salary*0.15;
ELSE IF (salary>44701 and salary<=89401) THEN SET tax=44701*0.15+(salary-44701)*0.22;
ELSE IF (salary>89401 and salary<=138586) THEN SET tax=44701*0.15+(89401-44701)*0.22+(salary-89401)*0.26;
END IF
END IF
ELSE SET tax=44701*0.15+(89401-44701)*0.22+(138596-89401)*0.26+(salary-138586)*0.29;
END IF
end