SlideShare a Scribd company logo
1 of 4
//Run SQL1 to check if there is amortization
SQL1 =
       SELECT distinct notnl from profile
       WHERE ins_num = ins_num
       AND     param_seq_num= leg_num


IF SQL1 RETURNS ONE ROW THEN //there is no amortization in this leg
        DO NOT GENERATE notionalStepSchedule/step

ELSE IF SQL1 RETURNS MORE THAN 1 ROW THEN
         SQL2 =
                 SELECT START_DATE, NOTNL from profile
                 WHERE ins_num = ins_num
                 AND    param_seq_num= leg_num
                 ORDER BY profile_seq_num
Run SQL2
FOR EACH ROW RETURNED BY SQL2 generate one step tag
         <step>
           <stepDate> START_DATE </stepDate> //FORMAT YYYY-MM-DD
           <stepValue> NOTNL </stepValue>//FORMAT IT TO HAVE 6 DECIMALS.
         </step>



Example:
Leg 1




Results of SQL1
The step tag must be generated, because number of rows returned is > 1

Results of SQL2
The xml generated will be like this
<notionalSchedule>
       <notionalStepSchedule>
       <initialValue>100000000</initialValue>

       <step>
         <stepDate>2013-01-15</stepDate>
         <stepValue>100000000</stepValue>
       </step>
       <step>
         <stepDate>2013-04-15</stepDate>
         <stepValue> 88047213.615783 </stepValue>
       </step>
       <step>
         <stepDate> 2013-07-15 </stepDate>
         <stepValue> 75942029.205168 </stepValue>
       </step>
       <step>
         <stepDate>2013-10-15</stepDate>
         <stepValue> 63682503.693317 </stepValue>
       </step>
       <step>
         <stepDate>2014-01-15</stepDate>
         <stepValue> 51266669.231190 </stepValue>
       </step>
       <step>
         <stepDate>2014-04-15</stepDate>
         <stepValue> 38692532.879671</stepValue>
       </step>
       <step>
         <stepDate>2014-07-15</stepDate>
         <stepValue> 25958076.289669</stepValue>
       </step>
       <step>
         <stepDate>2014-10-15</stepDate>
         <stepValue> 13061255.378146</stepValue>
       </step>
<notionalSchedule>


FOR LEG 2
SQL1 returned only 1 row




Then the step tag will not be generated.

<notionalSchedule>
       <initialValue>100000000</initialValue>
</notionalSchedule>

More Related Content

Viewers also liked (6)

Chapitre 5 rdm
Chapitre 5 rdmChapitre 5 rdm
Chapitre 5 rdm
 
Club matemático juguetón reforzamiento vacacional
Club matemático juguetón reforzamiento vacacionalClub matemático juguetón reforzamiento vacacional
Club matemático juguetón reforzamiento vacacional
 
Finland - top talent available for ICT companies
Finland - top talent available for ICT companiesFinland - top talent available for ICT companies
Finland - top talent available for ICT companies
 
Patologías respiratorias
Patologías  respiratoriasPatologías  respiratorias
Patologías respiratorias
 
AERJ Publication
AERJ PublicationAERJ Publication
AERJ Publication
 
โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์
 

Similar to Step spec

T sql denali code Day of .Net
T sql denali code Day of .NetT sql denali code Day of .Net
T sql denali code Day of .Net
KathiK58
 

Similar to Step spec (14)

lecture13.ppt
lecture13.pptlecture13.ppt
lecture13.ppt
 
T sql denali code Day of .Net
T sql denali code Day of .NetT sql denali code Day of .Net
T sql denali code Day of .Net
 
One page app with AngularJS
One page app with AngularJSOne page app with AngularJS
One page app with AngularJS
 
Test Dml With Nologging
Test Dml With NologgingTest Dml With Nologging
Test Dml With Nologging
 
PLSQL
PLSQLPLSQL
PLSQL
 
Plsql
PlsqlPlsql
Plsql
 
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
Tony jambu   (obscure) tools of the trade for tuning oracle sq lsTony jambu   (obscure) tools of the trade for tuning oracle sq ls
Tony jambu (obscure) tools of the trade for tuning oracle sq ls
 
Procedures and triggers in SQL
Procedures and triggers in SQLProcedures and triggers in SQL
Procedures and triggers in SQL
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
 
Rest with-spray
Rest with-sprayRest with-spray
Rest with-spray
 
Stored procedure Notes By Durgesh Singh
Stored procedure Notes By Durgesh SinghStored procedure Notes By Durgesh Singh
Stored procedure Notes By Durgesh Singh
 
Performance tuning
Performance tuningPerformance tuning
Performance tuning
 
Oracle 11g new features for developers
Oracle 11g new features for developersOracle 11g new features for developers
Oracle 11g new features for developers
 

Step spec

  • 1. //Run SQL1 to check if there is amortization SQL1 = SELECT distinct notnl from profile WHERE ins_num = ins_num AND param_seq_num= leg_num IF SQL1 RETURNS ONE ROW THEN //there is no amortization in this leg DO NOT GENERATE notionalStepSchedule/step ELSE IF SQL1 RETURNS MORE THAN 1 ROW THEN SQL2 = SELECT START_DATE, NOTNL from profile WHERE ins_num = ins_num AND param_seq_num= leg_num ORDER BY profile_seq_num Run SQL2 FOR EACH ROW RETURNED BY SQL2 generate one step tag <step> <stepDate> START_DATE </stepDate> //FORMAT YYYY-MM-DD <stepValue> NOTNL </stepValue>//FORMAT IT TO HAVE 6 DECIMALS. </step> Example: Leg 1 Results of SQL1
  • 2. The step tag must be generated, because number of rows returned is > 1 Results of SQL2
  • 3. The xml generated will be like this <notionalSchedule> <notionalStepSchedule> <initialValue>100000000</initialValue> <step> <stepDate>2013-01-15</stepDate> <stepValue>100000000</stepValue> </step> <step> <stepDate>2013-04-15</stepDate> <stepValue> 88047213.615783 </stepValue> </step> <step> <stepDate> 2013-07-15 </stepDate> <stepValue> 75942029.205168 </stepValue> </step> <step> <stepDate>2013-10-15</stepDate> <stepValue> 63682503.693317 </stepValue> </step> <step> <stepDate>2014-01-15</stepDate> <stepValue> 51266669.231190 </stepValue> </step> <step> <stepDate>2014-04-15</stepDate> <stepValue> 38692532.879671</stepValue> </step> <step> <stepDate>2014-07-15</stepDate> <stepValue> 25958076.289669</stepValue> </step> <step> <stepDate>2014-10-15</stepDate> <stepValue> 13061255.378146</stepValue> </step> <notionalSchedule> FOR LEG 2
  • 4. SQL1 returned only 1 row Then the step tag will not be generated. <notionalSchedule> <initialValue>100000000</initialValue> </notionalSchedule>