Proc Oracle that is similar to Excel FV() Function
Hi Guys.
I need to use in Oracle a function that shows me the same results that FV() financial function in Excel.
Using these parameters in Excel I got the result -29%
Rate: 1591,66
NPer: 18
PMT: 0,90083
I've been search on the web and I creat a function based on Newton-Raphson method. I'll post the source-code below.
CREATE OR REPLACE FUNCTION BI_F_FV(Rate IN NUMBER, PMT IN NUMBER, Nper IN NUMBER) RETURN NUMBER
AS
VAR_X NUMBER(12,10):= 1.50;
VAR_Y NUMBER(12,10):= 0.00;
BEGIN
WHILE TO_NUMBER(VAR_Y - 1) * 10000 <> TO_NUMBER(VAR_X - 1) * 10000 LOOP
VAR_Y:= VAR_X;
VAR_X:= VAR_Y - ((POWER(VAR_Y , (Nper + 1)) - (POWER(VAR_Y , Nper) * (PMT/Rate + 1)) + PMT/Rate) / (((Nper + 1) * POWER(VAR_Y , Nper)) - (Nper * (PMT/Rate + 1) * POWER(VAR_Y , (Nper - 1)))));
END LOOP;
RETURN (VAR_X-1);
END BI_F_FV;
But when I use the same parameters tha I had put in Excel, it shows me 0 instead -29. Anyone have a sample of FV() function in Oracle or can help me to solve this problem?
Regards.
Luiz Araujo