Forum Stats

  • 3,758,107 Users
  • 2,251,330 Discussions
  • 7,870,033 Comments

Discussions

Write a SQL query interpolation logic in the original tenor basis and reset the tenor basis in the u

User_GVVDS
User_GVVDS Member Posts: 6 Green Ribbon
edited Apr 22, 2021 12:15PM in SQL & PL/SQL

Write a SQL query interpolation logic in the original tenor basis and reset the tenor basis in the using oracle procedure.

required for interpolation logic


create table STG_TEMP

(

SLABEL varchar2(20),

HDATE  DATE,

TBPERC Number(15,5),

original_tenor number(10,2),

RESET_TENOR  number(10));


this is the original value


insert into STG_TEMP(SLABEL,HDATE,TBPERC,original_tenor,reset_tenor)

values('USD','03-MAR-2021',0.128592,0,1); 

insert into STG_TEMP(SLABEL,HDATE,TBPERC,original_tenor,reset_tenor)

values('USD','03-MAR-2021',0.1792420,1,30);

insert into STG_TEMP(SLABEL,HDATE,TBPERC,original_tenor,reset_tenor)

values('USD','03-MAR-2021',0.1803930,2,60);


input

-------------

SLABEL HDATE    TBPERC   original_tenor reset_tenor

------ ---------  ----------- -------------  ----------

USD 03-MAR-2021   0.128592    0         1

USD 03-MAR-2021   0.1792420   1         30

USD 03-MAR-2021   0.1803930   2         60


output

------------------------------------------------------


SLABEL HDATE    TBPERC   original_tenor reset_tenor

------ ---------  ----------- -------------  ----------

USD 03-MAR-2021   0.128592   0         1

USD 03-MAR-2021   0.133657   0.1        2

USD 03-MAR-2021   0.138722   0.2        3

USD 03-MAR-2021   0.143787   0.3        4

USD 03-MAR-2021   0.148852   0.4        5

USD 03-MAR-2021   0.153917   0.5        6

USD 03-MAR-2021   0.158982   0.6        7

USD 03-MAR-2021   0.164047   0.7        8

USD 03-MAR-2021   0.169112   0.8        9

USD 03-MAR-2021   0.174177   0.9        10

USD 03-MAR-2021   0.1792420   1         30

USD 03-MAR-2021   0.1793571   1.1        31

Answers