Reputation: 13434
DELIMITER $$
DROP FUNCTION IF EXISTS `workplantype`.`FUN_STOCKINVENTRY_CHECK` $$
CREATE FUNCTION `workplantype`.`FUN_STOCKINVENTRY_CHECK` (
PONo1 VARCHAR(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?
Upvotes: 0
Views: 5520
Reputation: 14100
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
Upvotes: 3