0

我有一个如下的 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 - Commands out of sync; 你现在不能运行这个命令

4

1 回答 1

0

这是一个错误。传递给函数的参数名错误。非常感谢 Arvindh Mani。

于 2017-08-03T17:17:37.587 回答