我有一个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 - 命令不同步;你现在不能运行这个命令。
答案 0 :(得分:0)
这是一个错误。错误的参数传递给了函数。非常感谢Arvindh Mani。