# writing a function for the given scenario

**SB2011**Feb 24, 2013 5:11 AM

Hi ,

I have the following scenario for which I have to write a function without hard coding the values of interest and to return the simple interest.

I have two tables customer(amt(the amount to be deposited by customer in the bank),strtdte(investment start day),enddte(investment end day).) and rates (Rates table has three columns rate(rate of interest ex 8%),lotenure and hightenure columns define a range.)as follows

For a particular customer I have to calculate the simple interest and total amount (capital+SI) and return it.But if the tenure of investment is between 0 and 60 days rate of interest is 8%(this can be changed ) , if between 61 and 100 rate of interest will be different ex. 10%(which can be change).I have to write the code so that even if the interest rate will change for different tenure range,code should work.

(The rate value should not be hard coded because the rate can be changed at any time eg: it can be 8.5% for the period of 0 to 60 Days and after that it can be 10.25% for 61 to 100 days.)

Oracle version is 10g.

Thanks & Regards,

SB2011

Edited by: SB2011 on Feb 23, 2013 9:01 PM

I have the following scenario for which I have to write a function without hard coding the values of interest and to return the simple interest.

I have two tables customer(amt(the amount to be deposited by customer in the bank),strtdte(investment start day),enddte(investment end day).) and rates (Rates table has three columns rate(rate of interest ex 8%),lotenure and hightenure columns define a range.)as follows

```
Customers
--------------------------------------------
custid amt strdte enddte
001 5000 31-jan-2011 28-feb-2011
002 10,000 31-jan-2011 31-july-2011
```

```
rates
------------------------------
rate lotenure higtenure
8% 0 60
10% 61 100
```

If the tenure(difference of startdte and enddte in customer table) falls in the range lotenure(0 days) and hightenure(60 days) then a particular interest rate.Similarly for other ranges rate will be different.For a particular customer I have to calculate the simple interest and total amount (capital+SI) and return it.But if the tenure of investment is between 0 and 60 days rate of interest is 8%(this can be changed ) , if between 61 and 100 rate of interest will be different ex. 10%(which can be change).I have to write the code so that even if the interest rate will change for different tenure range,code should work.

(The rate value should not be hard coded because the rate can be changed at any time eg: it can be 8.5% for the period of 0 to 60 Days and after that it can be 10.25% for 61 to 100 days.)

Oracle version is 10g.

Thanks & Regards,

SB2011

Edited by: SB2011 on Feb 23, 2013 9:01 PM

I have the same question Show 0 Likes (0)

- 172 Views
- Tags: none (add)