Home » SQL & PL/SQL » SQL & PL/SQL » Help required on pl/sql technic for interest calculation
Help required on pl/sql technic for interest calculation [message #157472] Thu, 02 February 2006 11:23 Go to next message
angal_in
Messages: 12
Registered: July 2005
Location: chennai
Junior Member
Dear Askddbc,

I am in a critical situation in developing a program unit for calculating interest.

Following is the situation. looking for you help

The below is the loan details of a customer that is in the table


Loan refno transtype amount interest rate Date
100014 PBK 50000 6% 01-01-06
100014 PCP 10000 4.5% 10-01-06
100014 PCP 15000 6.5% 20-01-06
100014 PRL 40000 - 01-02-06
100014 PRL 20000 - 15-02-06
100014 PRL 15000 - 21-02-06

PBK - PURCHASE BILL BOOKING
PCP - ADDITION LOAN TAKEN
PRL - PART REALISATION

history of the loan

The customer on 01-01-06 has taken a loan of rs 50000 @ 6%
then on 10-01-2006 the customer is taking a additional loan of 10000@4.5%.Then again on 20-01-2006 the customer is taking a additional loan of 15000. so is total loan amount is 75000/-

Now the customer is repaying part of his loan amount of 40000 on
01-02-2006 and the an amount of rs 20000 on 15-02-2006 and finally the remaining amount on 21-02-06.

When the customer is paying the entier amount the interest will be calculated.In this case the interest will be calculated on 21-02-2006 as on that day he is paying the enter amount of the loan(75000).

The interest should be calculated as follows

01-01-06 to 09-01-06 50000@6%
10-01-06 to 19-01-06 50000@6%
10-01-06 to 19-01-06 10000@4.5%
20-01-06 to 31-01-06 50000@6%
20-01-06 to 31-01-06 10000@4.5%--as 40000 has been repayed that
amount is be ajusted with the 50000 taken on 01-01-06
20-01-06 to 31-01-06 15000@6.5%
01-02-06 to 14-02-06 10000@6%
01-02-06 to 14-02-06 10000@4.5%
15-02-06 to 21-02-06 15000@6.5%-- as the 20000 repayed on 15-02-06
is been ajusted with 10000 taken on 01-01-06 and other 10000 is been adjusted with the 10000 taken on 10-01-06. and the remaining amount of 15000 is the balance that has to be calucated @ 6.5% because that 15000
belongs to the loan taken on 20-01-06

that is the loan returned is to be ajusted with the loan amount taken and
the remaining amount has to be calculated on the interest rate given at the time
of loan taken

We are using oracle version 8

Could you please guide how this can be implemented.....

Waiting for your reply
  • Attachment: interest.txt
    (Size: 4.17KB, Downloaded 658 times)
Re: Help required on pl/sql technic for interest calculation [message #157503 is a reply to message #157472] Thu, 02 February 2006 16:36 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9106
Registered: November 2002
Location: California, USA
Senior Member
You posted a similar question on the same subject a couple of months ago and were asked to post what you had attempted yourself, but never posted anything. Please read the sticky at the top of the forum, then post create table and insert statements for your sample data, any other relevant information, and some attempt of your own. Why do you think you need pl/sql? Could you just use a sql statement to calculate the results or do you need to return the results as a ref cursor to another environment or do you need to update the interest column in the table or what? Also, this is not askddbc; this is OraFAQ. Also, Oracle 8 is no longer supported. You need to upgrade to at least 9i. You may need to use pl/sql in Oracle 8 to do what could be done in sql in Orcacle 9i. Is this for school or a job?


Re: Help required on pl/sql technic for interest calculation [message #157593 is a reply to message #157503] Fri, 03 February 2006 08:39 Go to previous messageGo to next message
angal_in
Messages: 12
Registered: July 2005
Location: chennai
Junior Member
hai

Actually this for my job.In the current procedure this situation was not handled.It will be better if you give an idea how this can be implemented or a sample program.

Regards
Angalppan
Re: Help required on pl/sql technic for interest calculation [message #157660 is a reply to message #157593] Fri, 03 February 2006 12:19 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9106
Registered: November 2002
Location: California, USA
Senior Member
No, that is not how we do things here. If you want help, then you will need to read the sticky, provide answers to the questions asked, and post create table and insert statements, and some attempt of your own. Otherwise, you can expect this post to be ignored, just as your other one was. If you are totally clueless, then you need to take some classes or find another line of work.
Re: Help required on pl/sql technic for interest calculation [message #157662 is a reply to message #157660] Fri, 03 February 2006 12:47 Go to previous message
William Robertson
Messages: 1643
Registered: August 2003
Location: London, UK
Senior Member
In principle you would apply compound interest with the POWER function.

For example, if you borrow £10 and the monthly interest rate is 10%, after 12 months you will owe

10 * POWER(1.1,12) = 31.38428376721

This is what you would get from entering "10 x 1.1" on a calculator and pressing "=" twelve times.

Notice that "10%" has been converted to "1.1", i.e. pct/100 + 1.

All the adjustment rules you posted seem pretty complicated, but I'm guessing they come down to variations on the same thing.

[Updated on: Fri, 03 February 2006 12:49]

Report message to a moderator

Previous Topic: Hello
Next Topic: table(cast working in 9i but not in 8i
Goto Forum:
  


Current Time: Sat Aug 16 03:19:42 CDT 2025