Create procedure Movestaff (input_staffID smallINT, new_deptID tinyINT)
BEGIN
declare old_deptID tinyINT;
start transaction;
select departmentID into old_deptID from staff where staffID=input_staffID;
update staff set departmentID = new_deptID where staffID=input_staffID;
update department set staffCount = staffCount-1 where departmentID =old_deptID;
update department set staffCount = staffCount+1 where departmentID =new_deptID;
Commit;
END
My teacher at uni provided us with this stored procedure to analyse and evaluate, except it doesn't work when trying to execute it. It's too late now to receive a reply (5pm). We only started this content recently. I'm receiving a generic MySQL error on line 3 - declare old_deptID.