首页 > 代码库 > 存储过程编写规范

存储过程编写规范

  --********************************************************    --* 存储过程名:EXP_TO_BATCH    --* 版本:1.0    --* 用途:批量导入报销(支持日常、加班、差旅、报销)  --* 参数:当前用户ID 批号  --* 输出:O_STATE:0成功 1:失败 O_MSG:成功或失败信息  --*    --* 作者:humeng  时间:2013-07-18   --********************************************************   PROCEDURE EXP_TO_BATCH(I_USER_ID  NUMBER,                         I_BATCH_NO VARCHAR2,                         O_STATE    OUT NUMBER,                         O_MSG      OUT VARCHAR2) IS    V_STATE               NUMBER := 0;    V_MSG                 VARCHAR2(2000) := ‘‘;    V_MSG1                VARCHAR2(2000) := ‘‘;    V_ERP_USER_ID         NUMBER;    V_COUNT1              NUMBER; --劳务稿酬数量    V_COUNT2              NUMBER; --日常、加班、差旅数量    V_COUNT3              NUMBER; --期间数量    V_COUNT4              NUMBER; --已导入数量    V_COUNT5              NUMBER; --本次导入数量    V_RESPONSIBILITY_NAME VARCHAR2(200); --职责名称    V_RESPONSIBILITY_ID   VARCHAR2(200); --职责ID    V_ORG_NAME            VARCHAR2(200); --OU名称    V_BATCH_NUM           VARCHAR2(200); --批号    V_OUTPUT_HEADER_ID    NUMBER; --导入头ID    V_INTERFACE_RUN_ID    NUMBER; --EBS请求号    E_ERR EXCEPTION;  BEGIN    NULL;    --判断ERP_USER_ID是否存在    IF I_USER_ID IS NULL OR I_BATCH_NO IS NULL THEN      V_STATE := ‘1‘;      V_MSG   := ‘用户ID或者批号不存在!‘;      RAISE E_ERR;    END IF;    BEGIN      SELECT SUA.ERP_USER_ID        INTO V_ERP_USER_ID        FROM SYS_USER_ALL SUA       WHERE SUA.USER_ID = I_USER_ID;    EXCEPTION      WHEN NO_DATA_FOUND THEN        V_STATE := ‘1‘;        V_MSG   := ‘用户ERP_USER_ID不存在!‘;        RAISE E_ERR;    END;    --劳务稿酬    FOR OPEN_DATA1 IN (SELECT EAH.ORG_ID                         FROM EXP_POST_LINE_TEMP     EPLT,                              EXP_EXPENSE_HEADERS    EEH,                              EXP_ACCOUNTING_HEADERS EAH                        WHERE 1 = 1                          AND NVL(EAH.DISABLED, 0) = 0                          AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID                          AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID                          AND EPLT.BATCH_NO = I_BATCH_NO                          AND EEH.EXPENSE_TYPE = ‘LABOR_AUTHOR‘                        GROUP BY EAH.ORG_ID) LOOP      BEGIN              BEGIN          SELECT PEOV.ORG_NAME            INTO V_ORG_NAME            FROM PR_ERP_ORG_V@EBS PEOV           WHERE PEOV.ORG_ID = OPEN_DATA1.ORG_ID;          SELECT PEURG.RESPONSIBILITY_NAME, PEURG.RESPONSIBILITY_ID            INTO V_RESPONSIBILITY_NAME, V_RESPONSIBILITY_ID            FROM PR_ERP_USER_RESP_GROUPS_V@EBS PEURG           WHERE PEURG.RESPONSIBILITY_NAME LIKE ‘%发票%‘             AND PEURG.USER_ID = V_ERP_USER_ID             AND PEURG.ORG_ID = OPEN_DATA1.ORG_ID;        EXCEPTION          WHEN OTHERS THEN            V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                     ‘劳务稿酬导入失败职责错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                     ‘,ERP_USER_ID:‘ || V_ERP_USER_ID;            RAISE E_ERR;        END;              --生成批号        SELECT CODING_LINK(‘EXP‘, ‘OUT‘, ‘‘) INTO V_BATCH_NUM FROM DUAL;              --更新批号到记账头表        UPDATE EXP_ACCOUNTING_HEADERS EAHU           SET EAHU.BATCH_NAME = V_BATCH_NUM, EAHU.ERP_UPLOAD_FLAG = ‘T‘         WHERE EAHU.EXPENSE_HEADER_ID IN               (SELECT EEH.EXPENSE_HEADER_ID                  FROM EXP_POST_LINE_TEMP     EPLT,                       EXP_EXPENSE_HEADERS    EEH,                       EXP_ACCOUNTING_HEADERS EAH                 WHERE 1 = 1                   AND NVL(EAH.DISABLED, 0) = 0                   AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID                   AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID                   AND EPLT.BATCH_NO = I_BATCH_NO                   AND EEH.EXPENSE_TYPE = ‘LABOR_AUTHOR‘                   AND EAH.ORG_ID = OPEN_DATA1.ORG_ID);              --存在导入的单据        SELECT COUNT(1)          INTO V_COUNT4          FROM EXP_POST_LINE_TEMP     EPLT,               EXP_EXPENSE_HEADERS    EEH,               EXP_ACCOUNTING_HEADERS EAH         WHERE 1 = 1           AND NVL(EAH.DISABLED, 0) = 0           AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID           AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID           AND EPLT.BATCH_NO = I_BATCH_NO           AND EEH.EXPENSE_TYPE = ‘LABOR_AUTHOR‘           AND EAH.ORG_ID = OPEN_DATA1.ORG_ID           AND EAH.ERP_UPLOAD_DATE IS NOT NULL;        IF V_COUNT4 <> 0 THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘劳务稿酬导入失败存在已导入单据:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘已导入数量:‘ || V_COUNT4;          RAISE E_ERR;        END IF;              --判断期间是否在        SELECT COUNT(1)          INTO V_COUNT3          FROM EXP_POST_LINE_TEMP     EPLT,               EXP_EXPENSE_HEADERS    EEH,               EXP_ACCOUNTING_HEADERS EAH,               SYS_ERP_PERIOD_V       SEPV         WHERE 1 = 1           AND NVL(EAH.DISABLED, 0) = 0           AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID           AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID           AND EPLT.BATCH_NO = I_BATCH_NO           AND EEH.EXPENSE_TYPE = ‘LABOR_AUTHOR‘           AND EAH.ORG_ID = OPEN_DATA1.ORG_ID           AND EAH.GL_DATE BETWEEN SEPV.START_DATE AND SEPV.END_DATE           AND SEPV.PERIOD_TYPE = ‘AP‘           AND SEPV.CLOSING_STATUS NOT IN (‘O‘, ‘F‘);        IF V_COUNT3 <> 0 THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘劳务稿酬导入失败存在非法期间:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘非法期间数量:‘ ||                   V_COUNT3;          RAISE E_ERR;        END IF;              --初始化接口表,返回头ID        CSYS_OUTPUT_ERP_PKG.OUTPUT_ERP_INITIALIZTION(‘APINV‘,                                                     I_USER_ID,                                                     ‘EXP_DAILY_TYPE_WORKFLOW‘,                                                     V_OUTPUT_HEADER_ID,                                                     V_MSG1);        IF V_OUTPUT_HEADER_ID IS NULL OR V_MSG1 IS NOT NULL THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘劳务稿酬导入失败初始化接口表错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘原因:‘ || V_MSG1;          RAISE E_ERR;        END IF;              --把职责ID记录到导入头表中,方便自动导核销时使用        UPDATE SYS_OUTPUT_ERP_HEADERS SOEH           SET SOEH.RESPONSBILITY_ID = V_RESPONSIBILITY_ID         WHERE SOEH.OUTPUT_HEADER_ID = V_OUTPUT_HEADER_ID;              --更新记账头表OUTPUT_HEADER_ID        UPDATE EXP_ACCOUNTING_HEADERS EAHU           SET EAHU.OUTPUT_HEADER_ID = V_OUTPUT_HEADER_ID,               EAHU.LAST_UPDATED_BY  = I_USER_ID,               EAHU.LAST_UPDATE_DATE = SYSDATE         WHERE NVL(EAHU.DISABLED, 0) = 0           AND EAHU.EXPENSE_HEADER_ID IN               (SELECT EEH.EXPENSE_HEADER_ID                  FROM EXP_POST_LINE_TEMP     EPLT,                       EXP_EXPENSE_HEADERS    EEH,                       EXP_ACCOUNTING_HEADERS EAH                 WHERE 1 = 1                   AND NVL(EAH.DISABLED, 0) = 0                   AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID                   AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID                   AND EPLT.BATCH_NO = I_BATCH_NO                   AND EEH.EXPENSE_TYPE = ‘LABOR_AUTHOR‘                   AND EAH.ORG_ID = OPEN_DATA1.ORG_ID);        --导入劳务稿酬到接口表        CSYS_OUTPUT_ERP_PKG.OUTPUT_ERP_INSERT_EXP_DATA(V_OUTPUT_HEADER_ID,                                                       NULL,                                                       V_MSG1);        IF V_MSG1 IS NOT NULL THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘劳务稿酬导入失败导入劳务稿酬到接口表错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘原因:‘ || V_MSG1;          RAISE E_ERR;        END IF;        --更新接口表状态行        CSYS_OUTPUT_ERP_PKG.STATE_UPDATE(V_OUTPUT_HEADER_ID,                                         I_USER_ID,                                         V_MSG1);        IF V_MSG1 IS NOT NULL THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘劳务稿酬导入失败更新接口表状态行错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘原因:‘ || V_MSG1;          RAISE E_ERR;        END IF;        --本次导入数量        SELECT COUNT(DISTINCT EEH.EXPENSE_HEADER_ID)          INTO V_COUNT5          FROM EXP_POST_LINE_TEMP     EPLT,               EXP_EXPENSE_HEADERS    EEH,               EXP_ACCOUNTING_HEADERS EAH         WHERE 1 = 1           AND NVL(EAH.DISABLED, 0) = 0           AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID           AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID           AND EPLT.BATCH_NO = I_BATCH_NO           AND EEH.EXPENSE_TYPE = ‘LABOR_AUTHOR‘           AND EAH.ORG_ID = OPEN_DATA1.ORG_ID           AND EAH.ERP_UPLOAD_DATE IS NULL;        COMMIT;        --导入数据到EBS        CSYS_OUTPUT_ERP_PKG.OUTPUT_AP_INV_IMP_DATA(V_OUTPUT_HEADER_ID,                                                   V_ERP_USER_ID,                                                   V_RESPONSIBILITY_ID,                                                   ‘PR‘,                                                   ‘1A2B3C4D5E6F‘,                                                   ‘AP_INV_IMP‘,                                                   V_INTERFACE_RUN_ID,                                                   V_MSG1);        IF V_MSG1 IS NOT NULL THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘劳务稿酬导入失败导入EBS错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘原因:‘ || V_MSG1;          RAISE E_ERR;        END IF;        V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME || ‘劳务稿酬导入成功:‘ ||                 ‘&nbsp;导入职责:‘ || V_RESPONSIBILITY_NAME || ‘&nbsp;导入数量:‘ ||                 V_COUNT5 || ‘&nbsp;批号:‘ || V_BATCH_NUM || ‘&nbsp;请求号:‘ ||                 V_INTERFACE_RUN_ID;        COMMIT;      EXCEPTION        WHEN E_ERR THEN          ROLLBACK;      END;    END LOOP;    --日常报销、加班、差旅    FOR OPEN_DATA1 IN (SELECT EAH.ORG_ID                         FROM EXP_POST_LINE_TEMP     EPLT,                              EXP_EXPENSE_HEADERS    EEH,                              EXP_ACCOUNTING_HEADERS EAH                        WHERE 1 = 1                          AND NVL(EAH.DISABLED, 0) = 0                          AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID                          AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID                          AND EPLT.BATCH_NO = I_BATCH_NO                          AND EEH.EXPENSE_TYPE <> ‘LABOR_AUTHOR‘                        GROUP BY EAH.ORG_ID) LOOP      BEGIN              BEGIN          SELECT PEOV.ORG_NAME            INTO V_ORG_NAME            FROM PR_ERP_ORG_V@EBS PEOV           WHERE PEOV.ORG_ID = OPEN_DATA1.ORG_ID;          SELECT PEURG.RESPONSIBILITY_NAME, PEURG.RESPONSIBILITY_ID            INTO V_RESPONSIBILITY_NAME, V_RESPONSIBILITY_ID            FROM PR_ERP_USER_RESP_GROUPS_V@EBS PEURG           WHERE PEURG.RESPONSIBILITY_NAME LIKE ‘%发票%‘             AND PEURG.USER_ID = V_ERP_USER_ID             AND PEURG.ORG_ID = OPEN_DATA1.ORG_ID;        EXCEPTION          WHEN OTHERS THEN            V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                     ‘日常、加班、差旅报销导入失败职责错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                     ‘,ERP_USER_ID:‘ || V_ERP_USER_ID;            RAISE E_ERR;        END;              --生成批号        SELECT CODING_LINK(‘EXP‘, ‘OUT‘, ‘‘) INTO V_BATCH_NUM FROM DUAL;              --更新批号到记账头表        UPDATE EXP_ACCOUNTING_HEADERS EAHU           SET EAHU.BATCH_NAME = V_BATCH_NUM, EAHU.ERP_UPLOAD_FLAG = ‘T‘         WHERE EAHU.EXPENSE_HEADER_ID IN               (SELECT EEH.EXPENSE_HEADER_ID                  FROM EXP_POST_LINE_TEMP     EPLT,                       EXP_EXPENSE_HEADERS    EEH,                       EXP_ACCOUNTING_HEADERS EAH                 WHERE 1 = 1                   AND NVL(EAH.DISABLED, 0) = 0                   AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID                   AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID                   AND EPLT.BATCH_NO = I_BATCH_NO                   AND EEH.EXPENSE_TYPE <> ‘LABOR_AUTHOR‘                   AND EAH.ORG_ID = OPEN_DATA1.ORG_ID);              --存在导入的单据        SELECT COUNT(1)          INTO V_COUNT4          FROM EXP_POST_LINE_TEMP     EPLT,               EXP_EXPENSE_HEADERS    EEH,               EXP_ACCOUNTING_HEADERS EAH         WHERE 1 = 1           AND NVL(EAH.DISABLED, 0) = 0           AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID           AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID           AND EPLT.BATCH_NO = I_BATCH_NO           AND EEH.EXPENSE_TYPE <> ‘LABOR_AUTHOR‘           AND EAH.ORG_ID = OPEN_DATA1.ORG_ID           AND EAH.ERP_UPLOAD_DATE IS NOT NULL;        IF V_COUNT4 <> 0 THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘日常、加班、差旅报销导入失败存在已导入单据:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘已导入数量:‘ || V_COUNT4;          RAISE E_ERR;        END IF;              --判断期间是否在        SELECT COUNT(1)          INTO V_COUNT3          FROM EXP_POST_LINE_TEMP     EPLT,               EXP_EXPENSE_HEADERS    EEH,               EXP_ACCOUNTING_HEADERS EAH,               SYS_ERP_PERIOD_V       SEPV         WHERE 1 = 1           AND NVL(EAH.DISABLED, 0) = 0           AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID           AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID           AND EPLT.BATCH_NO = I_BATCH_NO           AND EEH.EXPENSE_TYPE <> ‘LABOR_AUTHOR‘           AND EAH.ORG_ID = OPEN_DATA1.ORG_ID           AND EAH.GL_DATE BETWEEN SEPV.START_DATE AND SEPV.END_DATE           AND SEPV.PERIOD_TYPE = ‘AP‘           AND SEPV.CLOSING_STATUS NOT IN (‘O‘, ‘F‘);        IF V_COUNT3 <> 0 THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘日常、加班、差旅报销导入失败存在非法期间:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘非法期间数量:‘ ||                   V_COUNT3;          RAISE E_ERR;        END IF;              --初始化接口表,返回头ID        CSYS_OUTPUT_ERP_PKG.OUTPUT_ERP_INITIALIZTION(‘APINV‘,                                                     I_USER_ID,                                                     ‘EXP_DAILY_TYPE_WORKFLOW‘,                                                     V_OUTPUT_HEADER_ID,                                                     V_MSG1);        IF V_OUTPUT_HEADER_ID IS NULL OR V_MSG1 IS NOT NULL THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘日常、加班、差旅报销导入失败初始化接口表错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘原因:‘ || V_MSG1;          RAISE E_ERR;        END IF;              --把职责ID记录到导入头表中,方便自动导核销时使用        UPDATE SYS_OUTPUT_ERP_HEADERS SOEH           SET SOEH.RESPONSBILITY_ID = V_RESPONSIBILITY_ID         WHERE SOEH.OUTPUT_HEADER_ID = V_OUTPUT_HEADER_ID;              --更新记账头表OUTPUT_HEADER_ID        UPDATE EXP_ACCOUNTING_HEADERS EAHU           SET EAHU.OUTPUT_HEADER_ID = V_OUTPUT_HEADER_ID,               EAHU.LAST_UPDATED_BY  = I_USER_ID,               EAHU.LAST_UPDATE_DATE = SYSDATE         WHERE NVL(EAHU.DISABLED, 0) = 0           AND EAHU.EXPENSE_HEADER_ID IN               (SELECT EEH.EXPENSE_HEADER_ID                  FROM EXP_POST_LINE_TEMP     EPLT,                       EXP_EXPENSE_HEADERS    EEH,                       EXP_ACCOUNTING_HEADERS EAH                 WHERE 1 = 1                   AND NVL(EAH.DISABLED, 0) = 0                   AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID                   AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID                   AND EPLT.BATCH_NO = I_BATCH_NO                   AND EEH.EXPENSE_TYPE <> ‘LABOR_AUTHOR‘                   AND EAH.ORG_ID = OPEN_DATA1.ORG_ID);        --导入日常报销到接口表        CSYS_OUTPUT_ERP_PKG.OUTPUT_ERP_INSERT_EXP_DATA(V_OUTPUT_HEADER_ID,                                                       NULL,                                                       V_MSG1);        IF V_MSG1 IS NOT NULL THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘日常、加班、差旅报销导入失败导入日常报销到接口表错误:ORG_ID:‘ ||                   OPEN_DATA1.ORG_ID || ‘,ERP_USER_ID:‘ || V_ERP_USER_ID ||                   ‘原因:‘ || V_MSG1;          RAISE E_ERR;        END IF;        --更新接口表状态行        CSYS_OUTPUT_ERP_PKG.STATE_UPDATE(V_OUTPUT_HEADER_ID,                                         I_USER_ID,                                         V_MSG1);        IF V_MSG1 IS NOT NULL THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘日常、加班、差旅报销导入失败更新接口表状态行错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘原因:‘ || V_MSG1;          RAISE E_ERR;        END IF;        --本次导入数量        SELECT COUNT(DISTINCT EEH.EXPENSE_HEADER_ID)          INTO V_COUNT5          FROM EXP_POST_LINE_TEMP     EPLT,               EXP_EXPENSE_HEADERS    EEH,               EXP_ACCOUNTING_HEADERS EAH         WHERE 1 = 1           AND NVL(EAH.DISABLED, 0) = 0           AND EAH.EXPENSE_HEADER_ID = EEH.EXPENSE_HEADER_ID           AND EPLT.ITEM3 = EAH.EXPENSE_HEADER_ID           AND EPLT.BATCH_NO = I_BATCH_NO           AND EEH.EXPENSE_TYPE <> ‘LABOR_AUTHOR‘           AND EAH.ORG_ID = OPEN_DATA1.ORG_ID           AND EAH.ERP_UPLOAD_DATE IS NULL;        COMMIT;        --导入数据到EBS        CSYS_OUTPUT_ERP_PKG.OUTPUT_AP_INV_IMP_DATA(V_OUTPUT_HEADER_ID,                                                   V_ERP_USER_ID,                                                   V_RESPONSIBILITY_ID,                                                   ‘PR‘,                                                   ‘1A2B3C4D5E6F‘,                                                   ‘AP_INV_IMP‘,                                                   V_INTERFACE_RUN_ID,                                                   V_MSG1);        IF V_MSG1 IS NOT NULL THEN          V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME ||                   ‘日常、加班、差旅报销导入失败导入EBS错误:ORG_ID:‘ || OPEN_DATA1.ORG_ID ||                   ‘,ERP_USER_ID:‘ || V_ERP_USER_ID || ‘&nbsp;原因:‘ ||                   V_MSG1;          RAISE E_ERR;        END IF;        V_MSG := V_MSG || ‘</br>‘ || V_ORG_NAME || ‘&nbsp;日常、加班、差旅报销导入成功:‘ ||                 ‘&nbsp;导入职责:‘ || V_RESPONSIBILITY_NAME || ‘&nbsp;导入数量:‘ ||                 V_COUNT5 || ‘&nbsp;批号:‘ || V_BATCH_NUM || ‘&nbsp;请求号:‘ ||                 V_INTERFACE_RUN_ID;        COMMIT;      EXCEPTION        WHEN E_ERR THEN          ROLLBACK;      END;    END LOOP;    O_STATE := V_STATE;    O_MSG   := V_MSG;    BEGIN      INSERT INTO SYS_LOG_ALL        (SYS_LOG_ID, MODULE, PRC_FUC_MET, PURPOSE, CREATION_DATE, MSG)      VALUES        (SYS_LOG_ALL_S.NEXTVAL,         ‘EXP_TO_BATCH‘,         ‘CSYS_APPROVAL_ALL.EXP_TO_BATCH‘,         ‘PR批量导入报销‘,         SYSDATE,         V_MSG);    END;    COMMIT;  EXCEPTION    WHEN E_ERR THEN      O_STATE := V_STATE;      O_MSG   := V_MSG;    WHEN OTHERS THEN      V_STATE := 1;      V_MSG   := V_MSG || SQLCODE || SQLERRM;      O_STATE := V_STATE;      O_MSG   := V_MSG;      ROLLBACK;      BEGIN        INSERT INTO SYS_LOG_ALL          (SYS_LOG_ID, MODULE, PRC_FUC_MET, PURPOSE, CREATION_DATE, MSG)        VALUES          (SYS_LOG_ALL_S.NEXTVAL,           ‘EXP_TO_BATCH‘,           ‘CSYS_APPROVAL_ALL.EXP_TO_BATCH‘,           ‘PR批量导入报销‘,           SYSDATE,           V_MSG);      END;      COMMIT;  END EXP_TO_BATCH;