开发者

not allowed to return a result set from a function mysql error?

开发者 https://www.devze.com 2023-01-06 16:14 出处:网络
DELIMITER $$ DROP FUNCTION IF EXISTS `workplantype`.`FUN_STOCKINVENTRY_CHECK` $$ CREATE FUNCTION `workplantype`.`FUN_STOCKINVENTRY_CHECK` (
DELIMITER $$

DROP FUNCTION IF EXISTS `workplantype`.`FUN_STOCKINVENTRY_CHECK` $$
CREATE FUNCTION `workplantype`.`FUN_STOCKINVENTRY_CHECK` (
PONo1 V开发者_开发技巧ARCHAR(20),
PartCode1 VARCHAR(45)
) RETURNS bool
BEGIN
DECLARE diff bool;
set diff=false;
select  if(Remaining_Quantity=0.00, true, false) as diff from tblstockinventory where PONo=PONo1 && PartCode=PartCode1;
return diff;
END $$

DELIMITER ;

how ro avoid the not allowed to return a result set from a function mysql error?


select if(Remaining_Quantity=0.00, true, false) into @diff 
from tblstockinventory 
where PONo=PONo1 AND PartCode=PartCode1;

You can reduce IF() to

select Remaining_Quantity=0.00 into @diff 

And get the same result

0

精彩评论

暂无评论...
验证码 换一张
取 消