Paste this in SQL assistant to gain understaing of indentation.
CASE WHEN PLNV.LMV_BUS_TYPE_NEW='COR' THEN CASE WHEN LM_PASS_THRU_EXPRESS_IND = '3' THEN LV_LX_FUND_PRIN_BAL ELSE CASE WHEN LV_LX_FUND_PRIN_BAL > 0 THEN LV_LX_FUND_PRIN_BAL – LV_LX_PROJ_PRIN_REDUC – LV_LX_PRIN_REDUCT ELSE [LM_AMT_LOAN – LV_LX_PROJ_PRIN_REDUC – LV_LX_PRIN_REDUCT ] END END
ELSE CASE WHEN PLNV.LMV_BUS_TYPE_NEW = ('WHS') THEN AD_CURR_PRIN_BAL ELSE CASE WHEN PLNV.LMV_BUS_TYPE_NEW) NOT IN ('COR','WHS') THEN LM_AMT_LOAN END END
END
Paste this in SQL assistant to gain understaing of indentation.
CASE WHEN PLNV.LMV_BUS_TYPE_NEW='COR' THEN
CASE WHEN LM_PASS_THRU_EXPRESS_IND = '3' THEN LV_LX_FUND_PRIN_BAL
ELSE
CASE WHEN LV_LX_FUND_PRIN_BAL > 0 THEN LV_LX_FUND_PRIN_BAL – LV_LX_PROJ_PRIN_REDUC – LV_LX_PRIN_REDUCT
ELSE [LM_AMT_LOAN – LV_LX_PROJ_PRIN_REDUC – LV_LX_PRIN_REDUCT ]
END
END
ELSE
CASE WHEN PLNV.LMV_BUS_TYPE_NEW = ('WHS') THEN AD_CURR_PRIN_BAL
ELSE
CASE WHEN PLNV.LMV_BUS_TYPE_NEW) NOT IN ('COR','WHS') THEN LM_AMT_LOAN
END
END
END