Function to Calculate Compound Interest


create or replace function CI_Calculator ( p_principal number
                                          , p_tenure number
                                          , p_compound_freq number
                                          , p_roi number) return number is
begin

 -- Formula to calculate compound interest
  -- Principal * ( 1 + (rate of interest% / n ) )^nt
 
  return round (p_principal * power( 1 + ((p_roi/100) / p_compound_freq ) , p_tenure ), 2 );

end CI_Calculator;


select ci_calculator (p_principal      => 100
                      ,p_tenure        => 5
                      ,p_compound_freq => 1
                      ,p_roi           => 7.9 ) maturity_amt
from dual;

Comments

Popular posts from this blog

How to use lexical parameters in Data template (XML document) R12

Query to get FSG report details with row/column set

Sub Inventory Transfer API.