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.* 位置定义不明确