Search code examples
sqldatabasedb2datastagecognos-10

Datastage Job terminating due to the following error


I'm running a data stage job, Input through DB2 and output to DB2. Input side has a query containing joins and functions.

I'm getting the following warning message;

TRN_HEALTH_INSURANCE_DETAIL,
2: STATEMENT 
INSERT
INTO
HEALTH_INSURANCE_DETAIL
(
    RISK_DETAIL_ID,
    RISK_COVER_ID,
    RD_POLICY_SYSTEM_NO,
    RD_POLICY_END_NO_IDX,
    RD_POLICY_ID,
    RD_LEVEL1_ID,
    RD_SUM_INSURED_AMT_LC,
    RD_PREMIUM_AMT_LC,
    PREMIUM_AMOUNT_FC,
    SUM_INSURED_AMT_FC,
    RD_REC_TYPE,
    RD_EFFECT_FROM_DT,
    RD_EFFECT_TO_DT,
    RD_END_EFFECT_FROM_DT,
    SEX_MAS_CD,
    MARITAL_STATUS_CD,
    EMP_CATG,
    NO_OF_DEPENDENTS,
    EMP_AL_NO,
    DOB,
    EFF_DATE,
    EFF_DATE2,
    NAME,
    RELATIONSHIP_CD_S,
    RELATIONSHIP_CD,
    DESIGNATION,
    BRANCH,
    BANK_ACCOUNT,
    BANK_BRANCH_NAME,
    PRE_EXISTING_AILMENT,
    AUTHORITY_LETTER_NO,
    AGE,
    REGION,
    CNIC,
    CO_CODE,
    EMP_LOCATION,
    SUB_LOCATION,
    CLH_SYSTEM_NO,
    CTH_SYS_ID,
    CTH_POL_SYS_ID,
    CTH_END_NO_IDX,
    CTH_END_SR_NO,
    CTH_CATEGORY,
    CLD_SYS_ID,
    CLDH_SYS_ID,
    CLD_COVER_CD,
    CLD_END_IDX,
    CLD_COVER_DESC,
    CLD_CLM_TYPE_LIMIT,
    CLD_CLM_REL,
    CLD_CLM_AGE_FROM,
    CLD_CLM_AGE_TO,
    CLD_CLM_RB_LIMIT,
    CLD_CATEGORY_LIMIT_FC,
    CLD_CATEGORY_PREM_FC
        )
            VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) failed to run.

I cant see such records in my data. The data quality is good. Then what are these ????, I search a bit and found a suggestion to keep the array size and row count to 1, instead of default 2000. But still I'm getting the same warning.

There are a lot of errors followed by this warning; The next error is also interesting.

TRN_HEALTH_INSURANCE_DETAIL,2: SQLExecute reported: SQLSTATE = 23505: Native Error Code = -803: Msg = [IBM][CLI Driver][DB2/NT64] SQL0803N  One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "DB2ADMIN.HEALTH_INSURANCE_DETAIL" from having duplicate values for the index key.  SQLSTATE=23505 (CC_DB2DBStatement::executeInsert, file CC_DB2DBStatement.cpp, line 1,095)

I believe the errors are due to the first warning. Kindly help me out. Regards, Nuh


Solution

  • Make a copy stage before the DB2 connector and put one link to the DB2 and the other to a dataset file to see the data in a data set. But the problem seems to be in the primary key you have a duplicate primary index or a duplicate unique index. It can be either in your data that you want to insert or maybe the table already have a record that you want to insert again