2021-06-21 03:36:18 +00:00
|
|
|
|
CREATE OR REPLACE PACKAGE telsale_policy_check_pkg IS
|
|
|
|
|
|
|
|
|
|
-- Author : <20><><EFBFBD><EFBFBD>
|
|
|
|
|
-- Created : 2021/6/21 10:18:01
|
|
|
|
|
-- Purpose : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤
|
|
|
|
|
|
2021-06-22 03:41:13 +00:00
|
|
|
|
/***************************************************************************/
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD>쳣
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
POLICYNO_NOT_EXIST_EXCEPT_CODE CONSTANT INTEGER := -20000;
|
|
|
|
|
POLICYNO_NOT_EXIST_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD>ڡ<EFBFBD>';
|
|
|
|
|
|
2021-06-22 10:34:30 +00:00
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD>
|
|
|
|
|
POLICYNO_IS_EXIST_EXCEPT_CODE CONSTANT INTEGER := -20001;
|
|
|
|
|
POLICYNO_IS_EXIST_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>';
|
|
|
|
|
|
2021-06-22 03:41:13 +00:00
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD>
|
2021-06-22 10:34:30 +00:00
|
|
|
|
OPERATOE_CODE_NOT_EXIST_EXCEPT_CODE CONSTANT INTEGER := -20002;
|
2021-06-22 03:41:13 +00:00
|
|
|
|
OPERATOE_CODE_NOT_EXIST_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '<27><><EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD><CBB9>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD>ڡ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
--¼<><C2BC><EFBFBD>˲<EFBFBD><CBB2><EFBFBD><EFBFBD><EFBFBD>
|
2021-06-22 10:34:30 +00:00
|
|
|
|
ENTRY_STAFF_CODE_NOT_EXIST_EXCEPT_CODE CONSTANT INTEGER := -20003;
|
2021-06-22 03:41:13 +00:00
|
|
|
|
ENTRY_STAFF_CODE_NOT_EXIST_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '¼<><C2BC><EFBFBD>˹<EFBFBD><CBB9>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD>ڡ<EFBFBD>';
|
|
|
|
|
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD><CBB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>
|
2021-06-22 10:34:30 +00:00
|
|
|
|
OPERATOE_CODE_NOT_MATCH_EXCEPT_CODE CONSTANT INTEGER := -20004;
|
2021-06-22 03:41:13 +00:00
|
|
|
|
OPERATOE_CODE_NOT_MATCH_EXCEPT_TEXT CONSTANT VARCHAR2(100) := '<27><><EFBFBD><EFBFBD><EFBFBD>˹<EFBFBD><CBB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD>뱣<EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD>䡣';
|
|
|
|
|
|
|
|
|
|
/***************************************************************************/
|
2021-06-21 03:36:18 +00:00
|
|
|
|
FUNCTION policy_check(a_policy_no VARCHAR2) RETURN BOOLEAN;
|
|
|
|
|
|
|
|
|
|
FUNCTION staff_check(a_stuff_code VARCHAR2) RETURN BOOLEAN;
|
|
|
|
|
|
2021-06-22 03:41:13 +00:00
|
|
|
|
PROCEDURE save_policy
|
|
|
|
|
(
|
|
|
|
|
a_policy_no IN VARCHAR2,
|
|
|
|
|
a_operator_code IN VARCHAR2,
|
|
|
|
|
a_operator_name OUT VARCHAR2,
|
|
|
|
|
a_operator_sectionoffice_code OUT VARCHAR2,
|
|
|
|
|
a_operator_sectionoffice_name OUT VARCHAR2,
|
|
|
|
|
a_operator_department_code OUT VARCHAR2,
|
|
|
|
|
a_operator_department_name OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_code IN VARCHAR2,
|
|
|
|
|
a_entry_staff_name OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_sectionoffice_code OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_sectionoffice_name OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_department_code OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_department_name OUT VARCHAR2
|
|
|
|
|
);
|
|
|
|
|
|
2021-06-21 03:36:18 +00:00
|
|
|
|
END telsale_policy_check_pkg;
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE PACKAGE BODY telsale_policy_check_pkg IS
|
|
|
|
|
|
2021-06-22 03:41:13 +00:00
|
|
|
|
/*********************************************************************************/
|
2021-06-21 03:36:18 +00:00
|
|
|
|
FUNCTION staff_check(a_stuff_code VARCHAR2) RETURN BOOLEAN IS
|
|
|
|
|
l_count INTEGER;
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT COUNT(*)
|
|
|
|
|
INTO l_count
|
|
|
|
|
FROM idst0.rydm_t@xmcx1.cpicxm ry
|
|
|
|
|
WHERE ry.staff_code = a_stuff_code;
|
|
|
|
|
|
|
|
|
|
IF l_count = 0
|
|
|
|
|
THEN
|
|
|
|
|
RETURN FALSE;
|
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
|
|
RETURN TRUE;
|
|
|
|
|
END;
|
|
|
|
|
|
2021-06-22 03:41:13 +00:00
|
|
|
|
/*********************************************************************************/
|
2021-06-21 03:36:18 +00:00
|
|
|
|
FUNCTION policy_check(a_policy_no VARCHAR2) RETURN BOOLEAN IS
|
|
|
|
|
l_count INTEGER;
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT COUNT(*)
|
|
|
|
|
INTO l_count
|
|
|
|
|
FROM idst0.auto_agreement_t@xmcx1.cpicxm a
|
|
|
|
|
WHERE a.policy_no = a_policy_no;
|
|
|
|
|
|
|
|
|
|
IF l_count = 0
|
|
|
|
|
THEN
|
|
|
|
|
RETURN FALSE;
|
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
|
|
RETURN TRUE;
|
|
|
|
|
END;
|
2021-06-22 03:41:13 +00:00
|
|
|
|
|
|
|
|
|
/*********************************************************************************/
|
|
|
|
|
PROCEDURE save_policy
|
|
|
|
|
(
|
|
|
|
|
a_policy_no IN VARCHAR2,
|
|
|
|
|
a_operator_code IN VARCHAR2,
|
|
|
|
|
a_operator_name OUT VARCHAR2,
|
|
|
|
|
a_operator_sectionoffice_code OUT VARCHAR2,
|
|
|
|
|
a_operator_sectionoffice_name OUT VARCHAR2,
|
|
|
|
|
a_operator_department_code OUT VARCHAR2,
|
|
|
|
|
a_operator_department_name OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_code IN VARCHAR2,
|
|
|
|
|
a_entry_staff_name OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_sectionoffice_code OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_sectionoffice_name OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_department_code OUT VARCHAR2,
|
|
|
|
|
a_entry_staff_department_name OUT VARCHAR2
|
|
|
|
|
) IS
|
2021-06-22 08:24:56 +00:00
|
|
|
|
l_policy_sectionoffice_code VARCHAR2(6);
|
|
|
|
|
l_policy_department_code VARCHAR2(6);
|
2021-06-22 03:41:13 +00:00
|
|
|
|
BEGIN
|
|
|
|
|
NULL;
|
|
|
|
|
|
|
|
|
|
--<2D>жϱ<D0B6><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵĿ<C5B5><C4BF>Ҳ<EFBFBD><D2B2>ź;<C5BA><CDBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ͬ
|
2021-06-22 08:24:56 +00:00
|
|
|
|
--<2D><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҺͲ<D2BA><CDB2><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT bd.section_office_code,
|
|
|
|
|
bd.department_code
|
|
|
|
|
INTO l_policy_sectionoffice_code,
|
|
|
|
|
l_policy_department_code
|
|
|
|
|
FROM idst0.auto_agreement_t@xmcx1.cpicxm bd
|
|
|
|
|
WHERE bd.policy_no = a_policy_no;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
WHEN NO_DATA_FOUND THEN
|
|
|
|
|
raise_application_error(POLICYNO_NOT_EXIST_EXCEPT_CODE,
|
|
|
|
|
POLICYNO_NOT_EXIST_EXCEPT_TEXT);
|
|
|
|
|
END;
|
2021-06-22 03:41:13 +00:00
|
|
|
|
|
2021-06-22 08:24:56 +00:00
|
|
|
|
--<2D><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT ry.staff_name,
|
|
|
|
|
ksh.section_office_code,
|
|
|
|
|
ksh.section_office_name,
|
|
|
|
|
bm.department_code,
|
|
|
|
|
bm.department_name
|
|
|
|
|
INTO a_operator_name,
|
|
|
|
|
a_operator_sectionoffice_code,
|
|
|
|
|
a_operator_sectionoffice_name,
|
|
|
|
|
a_operator_department_code,
|
|
|
|
|
a_operator_department_name
|
|
|
|
|
FROM idst0.rydm_t@xmcx1.cpicxm ry,
|
|
|
|
|
idst0.ks_t@xmcx1.cpicxm ksh,
|
|
|
|
|
idst0.bm_t@xmcx1.cpicxm bm
|
|
|
|
|
WHERE ry.section_office_code = ksh.section_office_code
|
|
|
|
|
AND ry.department_code = bm.department_code
|
|
|
|
|
AND ry.staff_code = a_operator_code;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
WHEN NO_DATA_FOUND THEN
|
|
|
|
|
raise_application_error(OPERATOE_CODE_NOT_EXIST_EXCEPT_CODE,
|
|
|
|
|
OPERATOE_CODE_NOT_EXIST_EXCEPT_TEXT);
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
|
|
--<2D><>֤¼<D6A4><C2BC><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
|
2021-06-23 03:40:48 +00:00
|
|
|
|
IF a_entry_staff_code IS NOT NULL
|
|
|
|
|
THEN
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT ry.staff_name,
|
|
|
|
|
ksh.section_office_code,
|
|
|
|
|
ksh.section_office_name,
|
|
|
|
|
bm.department_code,
|
|
|
|
|
bm.department_name
|
|
|
|
|
INTO a_entry_staff_name,
|
|
|
|
|
a_entry_staff_sectionoffice_code,
|
|
|
|
|
a_entry_staff_sectionoffice_name,
|
|
|
|
|
a_entry_staff_department_code,
|
|
|
|
|
a_entry_staff_department_name
|
|
|
|
|
FROM idst0.rydm_t@xmcx1.cpicxm ry,
|
|
|
|
|
idst0.ks_t@xmcx1.cpicxm ksh,
|
|
|
|
|
idst0.bm_t@xmcx1.cpicxm bm
|
|
|
|
|
WHERE ry.section_office_code = ksh.section_office_code
|
|
|
|
|
AND ry.department_code = bm.department_code
|
|
|
|
|
AND ry.staff_code = a_entry_staff_code;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
WHEN NO_DATA_FOUND THEN
|
|
|
|
|
raise_application_error(OPERATOE_CODE_NOT_EXIST_EXCEPT_CODE,
|
|
|
|
|
OPERATOE_CODE_NOT_EXIST_EXCEPT_TEXT);
|
|
|
|
|
END;
|
|
|
|
|
END IF;
|
2021-06-22 08:24:56 +00:00
|
|
|
|
|
|
|
|
|
--<2D>жϱ<D0B6><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<EFBFBD><CDBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD>Ƿ<EFBFBD>ƥ<EFBFBD>䣬<EFBFBD><E4A3AC>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
|
|
|
|
IF l_policy_sectionoffice_code != a_operator_sectionoffice_code OR
|
|
|
|
|
l_policy_department_code != a_operator_department_code
|
|
|
|
|
THEN
|
2021-06-23 04:13:06 +00:00
|
|
|
|
raise_application_error(OPERATOE_CODE_NOT_MATCH_EXCEPT_CODE,
|
|
|
|
|
OPERATOE_CODE_NOT_MATCH_EXCEPT_TEXT);
|
2021-06-22 08:24:56 +00:00
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
|
|
--û<><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD>¼
|
2021-06-22 10:34:30 +00:00
|
|
|
|
BEGIN
|
|
|
|
|
INSERT INTO telsale.<2E><><EFBFBD><EFBFBD><EFBFBD><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EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
VALUES
|
|
|
|
|
(a_policy_no,
|
|
|
|
|
a_operator_code,
|
|
|
|
|
a_operator_name,
|
|
|
|
|
a_operator_sectionoffice_code,
|
|
|
|
|
a_operator_sectionoffice_name,
|
|
|
|
|
a_operator_department_code,
|
|
|
|
|
a_operator_department_name,
|
|
|
|
|
a_entry_staff_code,
|
|
|
|
|
a_entry_staff_name,
|
|
|
|
|
a_entry_staff_sectionoffice_code,
|
|
|
|
|
a_entry_staff_sectionoffice_name,
|
|
|
|
|
a_entry_staff_department_code,
|
|
|
|
|
a_entry_staff_department_name,
|
|
|
|
|
SYSDATE);
|
|
|
|
|
EXCEPTION
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>
|
|
|
|
|
WHEN DUP_VAL_ON_INDEX THEN
|
|
|
|
|
raise_application_error(POLICYNO_IS_EXIST_EXCEPT_CODE,
|
|
|
|
|
POLICYNO_IS_EXIST_EXCEPT_TEXT);
|
|
|
|
|
END;
|
2021-06-22 03:41:13 +00:00
|
|
|
|
END;
|
|
|
|
|
|
2021-06-21 03:36:18 +00:00
|
|
|
|
BEGIN
|
|
|
|
|
NULL;
|
|
|
|
|
END telsale_policy_check_pkg;
|
|
|
|
|
/
|