I have written this code but its shows error at the line 10. in my Editor line 10 is INSERT INTO employee(Name,EmpCode,Salary). Below is my code
CREATE PROCEDURE `EmployeeAddOrEdit`(
IN _EmpID INT,
IN _Name varchar(45),
IN _EmpCode varchar(45),
IN _Salary int
)
BEGIN
IF _EmpID=0 THEN
INSERT INTO employee(Name,EmpCode,Salary)
VALUES (_Name,_EmpCode,_Salary);
SET _EmpID=LAST_INSERT_ID();
ELSE
UPDATE employee
SET
Name=_Name,
EmpCode=_EmpCode,
Salary=_Salary
WHERE EmpID=_EmpID;
END IF;
SELECT _EmpID AS 'EmpID';
END
This is the error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 10
