A coverage gap exists where a policy period's effective date does not continue the previous period's cancel/expiration date
NVL(p1.cancel_date, p1.policy_period_exp_date) <> p2.policy_period_eff_date over POLICY_PERIOD_ALL, restricted to statuses with POLICY_PERIOD_STATUS_CODE.pms_interface_flag = 'Y' and excluding 'FC' (flat cancel) and 'PPROS' (PMS prospect)
The greatest such following effective date becomes the candidate continuous-coverage date
PROC-RULE-029
With no gap in either the period chain or the coverage-gap table, coverage is continuous from the policy's history
v_max_eff_date IS NULL AND v_max_gap_date IS NULLorv_orig_date = v_max_eff_date
FUNCTIONsp72814_get_cont_cov_date(/*****************************************************************Procedure Title : Get Continous Coverage Date*Name : sp72814_get_cont_cov_date*Called by : UW295S****************************************************************** Description: Return the policy period effective date since the* last coverage gap.** Maintenance Log:* Name CSR Date Description* ----- ----- ---------- ----------------------------------* Lanpet 9 02/03/2004 Initial Release* Valrey 5.16 11/24/2004 Changed were derivation from policy_period* to policy_period_all and policy_coverage_gap tables.* (This procedure will be also used by view policy application.)* stevan 5.16 12/03/2004 CSR 26 - add historical continuous coverage date* to derivation of continuous coverage date*******************************************************************/in_policy_numINNUMBER)RETURNDATEISv_return_dateDATE;--v_max_cancel_date DATE := NULL;--v_min_eff_date DATE := NULL;v_orig_dateDATE:=NULL;v_hist_cont_cov_dateDATE:=NULL;v_max_eff_dateDATE:=NULL;v_max_gap_dateDATE:=NULL;BEGIN-- get the historical informtion on the policy'beginSELECThist_cont_coverage_date,policy_orig_eff_dateINTOv_hist_cont_cov_date,v_orig_dateFROMpolicyWHEREpolicy_num=in_policy_num;exceptionwhenno_data_foundthen-- do nothingnull;whenothersthenraise_application_error(-20002,sqlerrm);end;-- check for gaps first in policy_period_all-- this select will find the most recent policy period effective date that-- is the earliest effective date after the most recent effective date-- that does not correspond to a policy period expiration date-- all of the policy periods must not be either flat cnacels or PMS-- prospects.beginSELECTmax(p2.policy_period_eff_date)INTOv_max_eff_dateFROMpolicy_period_allp1,policy_period_allp2WHEREp1.policy_num=in_policy_numANDp1.policy_num=p2.policy_numANDnvl(p1.cancel_date,p1.policy_period_exp_date)<>p2.policy_period_eff_dateANDp1.policy_period_status_codeIN(SELECTcodeFROMpolicy_period_status_codeWHEREpms_interface_flag='Y'ANDcodeNOTIN('FC','PPROS'))ANDp1.policy_period_eff_date<>(SELECTmax(policy_period_eff_date)FROMpolicy_period_allWHEREpolicy_num=p1.policy_numANDpolicy_period_status_codeIN(SELECTcodeFROMpolicy_period_status_codeWHEREpms_interface_flag='Y'ANDcodeNOTIN('FC','PPROS')))ANDp2.policy_period_eff_date=(SELECTmin(policy_period_eff_date)FROMpolicy_period_allWHEREpolicy_num=p1.policy_numANDpolicy_period_eff_date>p1.policy_period_eff_dateANDpolicy_period_status_codeIN(SELECTcodeFROMpolicy_period_status_codeWHEREpms_interface_flag='Y'ANDcodeNOTIN('FC','PPROS')));exceptionwhenno_data_foundthen-- do nothingnull;whenothersthenraise_application_error(-20002,sqlerrm);end;begin-- check for gaps in the coverage gap tableSELECTmax(gap_exp_date)INTOv_max_gap_dateFROMpolicy_coverage_gapWHEREpolicy_num=in_policy_num;exceptionwhenno_data_foundthen-- do nothingnull;whenothersthenraise_application_error(-20002,sqlerrm);end;CASE-- first case: if both the maximum effective date (from policy_period_all)-- and the maximum gap date (from policy_coverage_gap) are null-- OR the max effective date is the same as the policy original date-- then return the historical continuous coverage date or the policy-- original coverage dateWHEN(v_max_eff_dateISNULLANDv_max_gap_dateISNULL)ORv_orig_date=v_max_eff_dateTHENv_return_date:=nvl(v_hist_cont_cov_date,v_orig_date);-- second case: if not the above, then if the gap date is null or-- the maximum effective date is greater than the gap date-- then return the maximum effective dateWHENv_max_gap_dateISNULLORv_max_eff_date>v_max_gap_dateTHENv_return_date:=v_max_eff_date;-- when all else fails: return the day after the maximum gap dateWHENTRUETHENv_return_date:=v_max_gap_date+1;ENDCASE;RETURNv_return_date;EXCEPTIONWHENothersTHENRAISE_APPLICATION_ERROR(-20001,'Error in sp72814: '||SQLCODE||' '||SQLERRM);ENDsp72814_get_cont_cov_date;
Note: Statements marked with * were inferred from code structure, naming conventions, or
contextual evidence where direct confirmation was not available in source artifacts. Statements
marked with ** could not be confirmed; treat as unknown until verified.