我更改了表中的列名,我需要更改它的函数。所以我改变了功能。但它仍然运行旧功能!它给了我:
"Error Code: 1054 Unknown column 'avDoctorID' in 'where clause'"
而且我确定我更改了功能,因为如果我看到功能本身,它就是新功能!怎么会这样?
我在 mysql 工作台中执行此操作,如果我在任何其他程序中看到该函数,它会显示新函数,但当我尝试运行它时会出现相同的错误。
这是运行它的查询
select FNC_CreateAppointment(8,1,"2012-08-06","15:30:00","something");
这就是函数本身:
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
返回的错误是:
call db_demo.FNC_CreateAppointment(8,1,"2012-08-06","15:30:00","something") Error Code: 1054 Unknown column 'avDoctorID' in 'where clause'
'avDoctorID' 是旧列