2017-08-03 25 views
0

工作我有一個MySQL的函數如下,但它產生的錯誤:MySQL的函數調用失敗,但在本地主機

BEGIN 
DECLARE image1 VARCHAR(250); 
select case when 
    (
     select COUNT(*) 
     from profile_images 
     where building_id = bid 
     and contractor_id = cid 
    ) > 0 
    then (
     select distinct (image) 
     -- into image1 
     from profile_images 
     where building_id = bid 
      and contractor_id = cid limit 1 
    ) else (
     select distinct (image) 
     -- into image1 
     from profile_images 
     where contractor_id = cid limit 1 
    ) 
END into image1; 
RETURN image1; 
END 

由MySQL所示的實際誤差是#2014 - 命令不同步;你現在不能運行這個命令

+1

您是否閱讀過手冊? https://dev.mysql.com/doc/refman/5.7/en/commands-out-of-sync.html –

+0

是的。我只是從my-sql查詢窗口調用函數,但仍然失敗 –

+0

在該文檔中提到關於光標,但我不知道如何處理光標 –

回答

0

這是一個錯誤。錯誤parametername傳遞給函數。非常感謝你Arvindh瑪尼。

+0

如果我對您的問題的格式編輯有幫助,請接受它,以便它變得永久。 –

相關問題