I changed a column name in a table, and i needed to change a function for it. So i changed the function. But it still runs the old function! it gives me :
"Error Code: 1054 Unknown column 'avDoctorID' in 'where clause'"
and i'm sure i changed the function because if i see the function itself it is the new one! how can this be?
i did this in mysql workbench, and if i see the function in any other program it show the new function, but gives the same error when i try to run it.
This is the query to run it
select FNC_CreateAppointment(8,1,"2012-08-06","15:30:00","something");
And this it the function itself:
DELIMITER $$
CREATE DEFINER=`root`@`%` FUNCTION `fnc_CreateAppointment`(clid int,calid int,appdate date,apptime time,commentaar varchar(3000)) RETURNS tinyint(1)
BEGIN
declare succeeded boolean;
declare id2 int;
declare id int;
declare dagweek int;
Declare afwezig int;
set afwezig = 0;
set dagweek = Dayofweek(appdate);
set id =0;
set id2 = 0;
set succeeded = false;
select availableID into id from tbl_available where AVdays = dagweek and AVHours = apptime and avCalendarID = calid
;
if id > 0
then
select appointmentID into id2 from tbl_appointment where appointmentDate = appdate and appointmentTime = apptime and CalendarID = calid;
if id2 = 0
then
select AbsentID into afwezig from tbl_absent where abHoliday = appdate and abAbsent = apptime and abCalendarID = calid;
if afwezig = 0 then
insert into tbl_appointment(clientId,Calendarid,appointmentDate,appointmenttime,remark)
Values
(clid,calid,appdate,apptime,commentaar);
set succeeded = true;
end if;
end if;
end if;
return succeeded;
END
the error returned is:
call db_demo.FNC_CreateAppointment(8,1,"2012-08-06","15:30:00","something") Error Code: 1054 Unknown column 'avDoctorID' in 'where clause'
'avDoctorID' is the old column
You might need to drop the function first and then run the CREATE statement again.
DROP FUNCTION IF EXISTS `<function_name>`