function doesn't return value
DROP FUNCTION IF EXISTS fn_GetEligibleBalance;
CREATE FUNCTION 'fn_GetEligibleBalance`(accountId int) RETURNS decimal
BEGIN
declare eligible_balance decimal;
select Balance into eligible_balance
from tb_account_transactions
where Id = (select max(Id) from tb_account_transactions where AccountId = accountId and EligibleDate <= curdate());
return(eligible_balance);
END;
select fn_GetEligibleBalance(3);
I always get 0 as return value though it have value. I get correct value if i ran select part separate. Is there any issue with select into statement inside a function.
Thanks
Siva
Subject
Written By
Posted
function doesn't return value
May 13, 2009 09:42AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.