在Teradata 15升级后更新声明未在BTEQ中提供正确结果

时间:2017-05-01 21:33:47

标签: teradata

在Teradata 15升级后,在BTEQ内执行时,更新语句不起作用。如果从SQL Assistant手动执行,该语句将提供所需的输出。该声明有一个简单的代码。

---更新声明

UPDATE MAIN2
        FROM 
            PSE_BIX_ABT.TP_ABT_DT_MOB_SBSCR_MAIN2 AS MAIN2,
            (
                SELECT DISTINCT
                    SBSCR_ID,  
                    ( SELECT DT FROM PSE_BIX_ABT.TP_ABT_DT_MOB_SBSCR_DT WHERE ID = 1 ) AS SNAP_DT,
                    SRVC_PRVDR_ID AS PORTED_IN_DNR_SP_ID,
                    SRVC_PRVDR_NM AS PORTED_IN_DNR_SP_NM,
                    OREPLACE(OREPLACE(SRVC_PRVDR_DESC,'[Fixed]',''),'[Mobile]','') AS PORTED_IN_DNR_SP_DESC,
                    PORT_STRT_DT AS PORTED_IN_DT,
                    CASE
                        WHEN PORTED_IN_DT = SNAP_DT THEN 1
                        ELSE 0
                    END AS PORTED_IN_CNT
                FROM 
                    PSE_BIX_SL_VW.V_F_PORTED_SBSCRS AS PORTED_SBSCR
                INNER JOIN 
                    PSE_BIX_SL_VW.V_SRVC_PRVDR SRVC
                    ON PORTED_SBSCR.DNR_SRVC_PRVDR_ID = SRVC.SRVC_PRVDR_ID
                WHERE 
                    PORT_IN_FL  = 1
                    AND SBSCR_ID <> -1
                    AND PORT_STRT_DT <= ( SELECT DT FROM PSE_BIX_ABT.TP_ABT_DT_MOB_SBSCR_DT WHERE ID = 1 )
                    AND (SBSCR_ID,PORT_STRT_DT) IN (SEL SBSCR_ID,MAX(PORT_STRT_DT) FROM PSE_BIX_SL_VW.V_F_PORTED_SBSCRS WHERE PORT_STRT_DT <=   ( SELECT DT FROM PSE_BIX_ABT.TP_ABT_DT_MOB_SBSCR_DT WHERE ID = 1 )  GROUP BY 1 )
            ) D_PORT_IN
        SET 
            PORTED_IN_DNR_SP_ID = D_PORT_IN.PORTED_IN_DNR_SP_ID,
            PORTED_IN_DNR_SP_NM = D_PORT_IN.PORTED_IN_DNR_SP_NM,
            PORTED_IN_DNR_SP_DESC = D_PORT_IN.PORTED_IN_DNR_SP_DESC,
            PORTED_IN_DT = D_PORT_IN.PORTED_IN_DT,
            PORTED_IN_CNT = D_PORT_IN.PORTED_IN_CNT
        WHERE 
            MAIN2.SBSCR_ID = D_PORT_IN.SBSCR_ID
            AND MAIN2.SNAP_DT = D_PORT_IN.SNAP_DT; 

请帮助。 目前Teradata 15.10.04.05(升级至14)

0 个答案:

没有答案