pk73343_output_document
Overview
Field
Value
Schema
WCIS_DBA
Type
Package
Database
Oracle
Calling libraries
SAIF.Business.Policy.Correspondence
Calling classes
clsOutputDocumentInserter
Purpose
pk73343_output_document creates policy output-document records in Oracle. The package inserts the base OUTPUT_DOCUMENT row, derives release status from the document type and hold flag, inserts the POLICY_OUTPUT_DOCUMENT link row, and standardizes error handling when the insert fails.
Procedures / Methods
insert_policy_output_document
Field
Value
Returns
No scalar return; writes one OUTPUT_DOCUMENT row and one POLICY_OUTPUT_DOCUMENT row.
Called by
clsOutputDocumentInserter.InsertOutputDocument, clsOutputDocumentInserter.InsertAgencyDeliveredOutputDocument
Description: Inserts a policy output document, derives hold/release status, and links the generated document to a policy period.
Parameters
Parameter
Direction
Type
Default
Description
in_policy_num
IN
NUMBER
—
Policy number.
in_policy_period_eff_date
IN
DATE
—
Policy-period effective date.
in_agency_seq_num
IN
NUMBER
—
Agency sequence number; zero is normalized to NULL.
in_agent_num
IN
NUMBER
—
Agent number; zero is normalized to NULL.
in_output_document_type_code
IN
VARCHAR2
—
Output-document type code used to derive agency visibility.
in_image_seq_num
IN
NUMBER
—
Imaging-system sequence number.
in_hold_flag
IN
VARCHAR2
—
Y/N hold flag.
in_agency_delivery_flag
IN
VARCHAR2
'N' or caller value
Agency-delivery flag passed by the wrapper overload.
in_create_user
IN
VARCHAR2
—
Creating user.
in_description
IN
VARCHAR2
—
Document description.
in_source_key_text
IN
VARCHAR2
—
Source-key text stored with the policy link row.
in_release_date
IN
DATE
NULL
Optional explicit release date.
Business Rules
Rule ID
Rule
Condition
Action
BR-024
Explicit release dates override the computed document date
in_release_date IS NOT NULL
Use the caller-supplied value as DOCUMENT_CREATE_DATE.
BR-025
Non-agency-viewable output documents release immediately
AGENCY_VIEW_FLAG = 'N'
Set document status to RELE.
BR-026
Held output documents require both agency visibility and hold flag
Agency-viewable document with in_hold_flag = 'Y'
Set document status to HELD.
BR-027
Agency-viewable non-held documents start pending
Agency-viewable document with any non-held flag
Set document status to PEND.
BR-028
Zero agency and agent numbers are normalized to NULL
in_agency_seq_num = 0 or in_agent_num = 0
Persist NULL instead of zero.
BR-029
Release dates are set only for released policy-output rows
v_document_status_code = 'RELE'
Write RELEASE_DATE; otherwise store NULL.
BR-030
The standard output-document overload defaults to non-agency delivery
11-argument overload
Delegate with in_agency_delivery_flag = 'N', null endorsement, and null task user.
BR-031
The agency-delivered overload passes the delivery flag through unchanged
12-argument overload
Delegate with the caller-supplied delivery flag.
BR-032
The output-document procedure raises a standard SAIF error on exception
WHEN OTHERS
Call pk73090_error_handler.raise_an_error(...).
Operations
Operation
Description
Trigger
Create output document record
Inserts OUTPUT_DOCUMENT using output_document_seq.NEXTVAL and returns the generated key.
Called from the two clsOutputDocumentInserter wrapper methods.
Resolve document status
Reads OUTPUT_DOCUMENT_TYPE_CODE.AGENCY_VIEW_FLAG and derives RELE, HELD, or PEND.
Executed after the base insert.
Link document to policy period
Inserts POLICY_OUTPUT_DOCUMENT with normalized agency/agent values and conditional release date.
Executed after status derivation.
Raise standard error
Re-raises any unhandled failure through pk73090_error_handler.raise_an_error.
Executed by the WHEN OTHERS handler.
Source Code
PL/SQL package specification excerpt
PACKAGE pk73343_output_document
AS
PROCEDURE insert_policy_output_document (
in_policy_num IN NUMBER ,
in_policy_period_eff_date IN DATE ,
in_agency_seq_num IN NUMBER ,
in_agent_num IN NUMBER ,
in_output_document_type_code IN VARCHAR2 ,
in_image_seq_num IN NUMBER ,
in_hold_flag IN VARCHAR2 ,
in_create_user IN VARCHAR2 ,
in_description IN VARCHAR2 ,
in_source_key_text IN VARCHAR2 ,
in_release_date IN DATE default NULL );
END pk73343_output_document ;
PL/SQL package body excerpt
v_document_create_date : = get_document_date ();
INSERT INTO output_document (
output_document_seq_num ,
output_document_type_code ,
document_create_date ,
image_seq_num ,
create_date ,
create_user ,
endorse_seq_num ,
description )
VALUES (
output_document_seq . NEXTVAL ,
in_output_document_type_code ,
CASE
WHEN in_release_date is not null THEN in_release_date
ELSE v_document_create_date
END ,
in_image_seq_num ,
SYSDATE ,
in_create_user ,
in_endorse_seq_num ,
in_description )
RETURN output_document_seq_num INTO v_output_document_seq_num ;
SELECT odtc . agency_view_flag
INTO v_agency_view_flag
FROM output_document_type_code odtc
WHERE odtc . code = in_output_document_type_code ;
v_document_status_code : =
CASE
WHEN v_agency_view_flag = 'N' THEN 'RELE'
WHEN in_hold_flag = 'Y' THEN 'HELD'
ELSE 'PEND'
END ;
Sources
Oracle DBA_SOURCE: WCIS_DBA.pk73343_output_document
Calling code: Business\SAIF.Business.Policy.Correspondence\clsOutputDocumentInserter.vb