Unanswered: Test and append
I have a database in which I store the interest rates of a number of currencies. These rates I get delivered from our Middle office. However there is one problem. I do not always get all rates delivered although I do need them all. I might for instance get the AUD 1 ,2, 3 and 5 years but I also need the 4 years. To solve this we usually copy the rate of a lower timebucket to the missing one. In this case this would mean that we would copy the rate of the 3 years to the 4 years and append it . This is however a manual process at the moment that needs to be automated as the number of records is growing.
What I therefore need is a piece of code that does the following:
Check if the 2 years rate is there, if not append a record with the two years rate. The rate needs to be a copy from the 1 years. After that it has to check if the 3 years rate is there, if not , append a record with the three years rate, the rate needs to be copied from the 2 years , and so on . This has to continue until the ten years has been reached so a loop has to be built in but it does have to start at the lowest value (1Y) and then climb.
The one years is always there so no problem there
Does anyone have an idea what the code should look like?
Nobody dies a virgin because life screws us all!