The following stored procedure returns nothing even if the matching data exists in the database.
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
is a boolean field. If the field is false or where clause is not satisfied, the procedure should return false
and when where clause is satisfied, it should return the column value. But it always returns an empty column.
What could be the reason for it?