2012-06-13 72 views
1

我改變了表中的列名,我需要改變它的功能。所以我改變了功能。但它仍然運行舊功能!它給了我:mysql:改變了功能,但保持舊功能

"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' 是老列

+1

需要一些更多的信息。你能顯示查詢嗎? –

+0

我編輯我的第一篇文章的查詢 – Nick

+0

在函數本身你有它定義爲fnc_CreateAppointment(),但然後你調用fnc_CreateAppointment2()。它應該是哪一個? –

回答

1

您可能需要先刪除該函數,然後再次運行CREATE語句。

DROP FUNCTION IF EXISTS `<function_name>` 
+0

這不起作用,但是我放棄了整個數據庫並將其導回,這很有效! – Nick