即使數據庫中存在匹配數據,以下存儲過程也不會返回任何結果。過程始終返回空列
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