0
SELECT 
    store_seq.NEXTVAL AS STORE_ID,
    DIST_WRK_STR.*
FROM
    (
        SELECT DISTINCT
            WRK_HHT.COUNTRY_ID AS COUNTRY_ID,
            CASE
                WHEN WRK_HHT.LOCAL_STORE_CD IS NULL THEN
                    WRK_HHT.TMP_STORE_CD
                ELSE
                    WRK_HHT.LOCAL_STORE_CD
            END AS LOCAL_STORE_CD,
            CASE
                WHEN WRK_HHT.LOCAL_STORE_CD IS NULL THEN
                    1
                ELSE
                    0
            END AS TMP_SLC_FLG,
            SYSDATE,
            SYSDATE 
        FROM  
            WRK_HHTLOGDATA WRK_HHT
            LEFT OUTER JOIN
                MST_STORE MST_STR
            ON
                WRK_HHT.COUNTRY_ID = MST_STR.COUNTRY_ID
                AND
                MST_STR.STORE_LOCAL_CD =
                (
                    CASE
                        WHEN WRK_HHT.LOCAL_STORE_CD IS NULL THEN
                            WRK_HHT.TMP_STORE_CD
                        ELSE
                            WRK_HHT.LOCAL_STORE_CD
                    END
                )
        WHERE
            MST_STR.STORE_ID IS NULL
            AND
            (
                WRK_HHT.LOCAL_STORE_CD IS NOT NULL
                OR
                WRK_HHT.TMP_STORE_CD IS NOT NULL
            )
            AND
            WRK_HHT.COUNTRY_ID = ncountry_id
            AND
            WRK_HHT.LOAD_ID = nload_id
    ) DIST_WRK_STR

大家好,

我收到错误,因为列名在 DIST_WRK_STR.* 位置定义不明确

4

1 回答 1

4

列列表中的内部SELECT列表SYSDATE两次。由于没有为它们中的任何一个提供列别名,因此 Oracle 命名了这两列"SYSDATE"并生成错误消息,因为它无法区分这两列。

于 2013-08-28T16:44:07.763 回答