Supplies the claim-side facts that SAIF.Framework.Validation needs before it
can evaluate a rule set, and records the outcome of that evaluation back into
the claims database. The package resolves a claim's policy period, servicing
branch, and jurisdiction into a single context row, applies the date and
jurisdiction checks that must run inside the database because they read tables
the library has no direct grant on, and writes one audit row per blocking
failure. It is the only object in CLAIMS that SAIF.Framework.Validation
is granted execute on.
SYS_REFCURSOR — one row containing policy period, jurisdiction, and servicing branch for the claim
Called by
ClaimValidationGateway.LoadContext
Description: Resolves the validation context for a single claim. The cursor
returns the policy effective and expiration dates used by the date-range rules,
the jurisdiction code that selects the state-scoped rule subset, and the
servicing branch used for routing failures. When the claim number does not
exist the cursor is opened empty and p_context_found is set to 0, so the
caller can distinguish "unknown claim" from "no rules applied".
Description: Applies the two date checks that require claims tables the
library cannot read directly: the date of injury must fall inside the policy
term, and the reported date must not precede the date of injury. Each violation
is written to CLAIM_VALIDATION_AUDIT through log_validation_failure and
counted in the return value. The function performs no commit; the caller owns
the transaction.
Description: Writes one audit row for a single blocking failure, stamping it
with the rule identifier, the run identifier, and the offending field name.
Duplicate rule identifiers within the same run are collapsed so a claim
re-validated inside one run does not produce repeated rows.
-- Actual PL/SQL spec retrieved from Oracle via Legends CLI-- Source: DBA_SOURCE / ALL_SOURCE for CLAIMS.PKG_CLAIM_VALIDATIONCREATEORREPLACEPACKAGECLAIMS.PKG_CLAIM_VALIDATIONASPROCEDUREget_validation_context(p_claim_numberINVARCHAR2,p_as_of_dateINDATEDEFAULTSYSDATE,p_context_foundOUTNUMBER,p_contextOUTSYS_REFCURSOR);FUNCTIONvalidate_claim_dates(p_claim_numberINVARCHAR2,p_injury_dateINDATE,p_reported_dateINDATE,p_run_idINNUMBER)RETURNNUMBER;PROCEDURElog_validation_failure(p_claim_numberINVARCHAR2,p_rule_idINVARCHAR2,p_field_nameINVARCHAR2,p_messageINVARCHAR2,p_run_idINNUMBER);ENDPKG_CLAIM_VALIDATION;
PL/SQL package/procedure body
-- Actual PL/SQL body retrieved from Oracle via Legends CLI-- Source: DBA_SOURCE / ALL_SOURCE for CLAIMS.PKG_CLAIM_VALIDATIONCREATEORREPLACEPACKAGEBODYCLAIMS.PKG_CLAIM_VALIDATIONASPROCEDUREget_validation_context(p_claim_numberINVARCHAR2,p_as_of_dateINDATEDEFAULTSYSDATE,p_context_foundOUTNUMBER,p_contextOUTSYS_REFCURSOR)ISv_policy_numberCLAIMS.CLAIM.POLICY_NUMBER%TYPE;BEGINp_context_found:=0;SELECTc.POLICY_NUMBERINTOv_policy_numberFROMCLAIMS.CLAIMcWHEREc.CLAIM_NUMBER=p_claim_number;SELECT1INTOp_context_foundFROMCLAIMS.POLICY_TERMtWHEREt.POLICY_NUMBER=v_policy_numberANDp_as_of_dateBETWEENt.EFFECTIVE_DATEANDt.EXPIRATION_DATEANDROWNUM=1;OPENp_contextFORSELECTc.CLAIM_NUMBER,t.POLICY_NUMBER,t.EFFECTIVE_DATEASPOLICY_EFFECTIVE_DATE,t.EXPIRATION_DATEASPOLICY_EXPIRATION_DATE,t.JURISDICTION_CODE,c.SERVICING_BRANCH_CODEFROMCLAIMS.CLAIMcJOINCLAIMS.POLICY_TERMtONt.POLICY_NUMBER=c.POLICY_NUMBERWHEREc.CLAIM_NUMBER=p_claim_numberANDp_as_of_dateBETWEENt.EFFECTIVE_DATEANDt.EXPIRATION_DATE;EXCEPTIONWHENNO_DATA_FOUNDTHENp_context_found:=0;OPENp_contextFORSELECTNULLASCLAIM_NUMBER,NULLASPOLICY_NUMBER,NULLASPOLICY_EFFECTIVE_DATE,NULLASPOLICY_EXPIRATION_DATE,NULLASJURISDICTION_CODE,NULLASSERVICING_BRANCH_CODEFROMDUALWHERE1=0;ENDget_validation_context;FUNCTIONvalidate_claim_dates(p_claim_numberINVARCHAR2,p_injury_dateINDATE,p_reported_dateINDATE,p_run_idINNUMBER)RETURNNUMBERISv_failuresNUMBER:=0;v_effectiveDATE;v_expirationDATE;BEGINBEGINSELECTt.EFFECTIVE_DATE,t.EXPIRATION_DATEINTOv_effective,v_expirationFROMCLAIMS.CLAIMcJOINCLAIMS.POLICY_TERMtONt.POLICY_NUMBER=c.POLICY_NUMBERWHEREc.CLAIM_NUMBER=p_claim_numberANDp_injury_dateBETWEENt.EFFECTIVE_DATEANDt.EXPIRATION_DATEANDROWNUM=1;EXCEPTIONWHENNO_DATA_FOUNDTHENv_effective:=NULL;v_expiration:=NULL;END;IFv_effectiveISNULLORp_injury_date<v_effectiveORp_injury_date>v_expirationTHENlog_validation_failure(p_claim_number=>p_claim_number,p_rule_id=>'VAL-014',p_field_name=>'INJURY_DATE',p_message=>'Date of injury is outside the policy term.',p_run_id=>p_run_id);v_failures:=v_failures+1;ENDIF;IFp_reported_date<p_injury_dateTHENlog_validation_failure(p_claim_number=>p_claim_number,p_rule_id=>'VAL-021',p_field_name=>'REPORTED_DATE',p_message=>'Reported date precedes the date of injury.',p_run_id=>p_run_id);v_failures:=v_failures+1;ENDIF;RETURNv_failures;ENDvalidate_claim_dates;PROCEDURElog_validation_failure(p_claim_numberINVARCHAR2,p_rule_idINVARCHAR2,p_field_nameINVARCHAR2,p_messageINVARCHAR2,p_run_idINNUMBER)ISBEGININSERTINTOCLAIMS.CLAIM_VALIDATION_AUDIT(AUDIT_ID,CLAIM_NUMBER,RULE_ID,FIELD_NAME,MESSAGE_TEXT,RUN_ID,CREATED_DATE)SELECTCLAIMS.SEQ_CLAIM_VALIDATION_AUDIT.NEXTVAL,p_claim_number,p_rule_id,p_field_name,p_message,p_run_id,SYSDATEFROMDUALWHERENOTEXISTS(SELECT1FROMCLAIMS.CLAIM_VALIDATION_AUDITaWHEREa.CLAIM_NUMBER=p_claim_numberANDa.RULE_ID=p_rule_idANDa.RUN_ID=p_run_id);ENDlog_validation_failure;ENDPKG_CLAIM_VALIDATION;