다음 저장된 프로시 저는 데이터베이스에 일치하는 데이터가 있어도 아무 것도 반환하지 않습니다.프로 시저 항상 빈 열을 반환합니다.
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
은 부울 필드입니다. 필드가 false이거나 where 절이 만족되지 않으면 프로시 저는 false
을 리턴해야하고 where 절이 충족 될 때 프로시 듀어는 컬럼 값을 리턴해야합니다. 하지만 항상 빈 열을 반환합니다.
왜 그럴 수 있습니까?
하지만 어쩌면이 다음에 유래 포스트 [선택에서 디스플레이 비트 값 (http://stackoverflow.com/questions/14248554/cant-see-mysql- bit-field-value-when-using-select) 도움이 될 것입니다 – g3suya