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中明确定义。*
答案 0 :(得分:4)
内部SELECT
在列列表中列出SYSDATE
两次。由于没有为它们中的任何一个提供列别名,因此Oracle将列"SYSDATE"
命名并生成错误消息,因为它无法区分这两列。