aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sql/et_tables.sql7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/et_tables.sql b/sql/et_tables.sql
index 39afcf60..f0eb185f 100644
--- a/sql/et_tables.sql
+++ b/sql/et_tables.sql
@@ -517,7 +517,12 @@ CREATE OR REPLACE FUNCTION et_deal_subordination(p_dealname varchar(10))
ON a.cusip = b.cusip ORDER BY b.cusip_id LOOP
curr_cumsum_cusip_bal := curr_cumsum_cusip_bal + cusip_row.curr_balance;
orig_cumsum_cusip_bal := orig_cumsum_cusip_bal + cusip_row.orig_balance;
- curr_subordination := curr_subordination || (curr_adjusted_collat_bal-curr_cumsum_cusip_bal)/deal_info."Curr Deal Bal";
+
+ IF deal_info."Curr Deal Bal" = 0 THEN
+ curr_subordination := curr_subordination || cast(NULL AS float);
+ ELSE
+ curr_subordination := curr_subordination || (curr_adjusted_collat_bal-curr_cumsum_cusip_bal)/deal_info."Curr Deal Bal";
+ END IF;
orig_subordination := orig_subordination || (orig_adjusted_collat_bal - orig_cumsum_cusip_bal)/deal_info."Orig Deal Bal";
cusips := cusips || cusip_row.Cusip;
IF i=1 THEN