即使数据库中存在匹配数据,以下存储过程也不会返回任何结果。过程始终返回空列
DELIMITER $$
DROP PROCEDURE IF EXISTS `portaldb`.`hasPrivateCloud`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `hasPrivateCloud`(in_userId int)
begin
if in_userId is not null then
select (case when ui.privateCloud is null
then false
else ui.privateCloud
end) as hasPrivateCloud from userinfo as ui where ui.userid = in_userId;
end if;
end$$
DELIMITER ;
privateCloud
是一个布尔字段。如果该字段为假或where子句不满足,则过程应返回false
,并且where子句满足时,它应返回列值。但它总是返回一个空列。
可能是什么原因呢?
也许这下面计算器后 [在选择显示位值(http://stackoverflow.com/questions/14248554/cant-see-mysql- bit-field-value-when-select-select)会帮助 – g3suya