SELECT |
STG.SCH_UID, |
STG.SCH_DESC, |
STG.SCH_IMPORT_UID, |
STG.SCH_GENERIC_UID, |
STG.SCH_HIE_ID, |
STG.SCH_HIE_UID, |
STG.SCH_HIE_DESC, |
STG.SCH_HIE_SCO_ID, |
STG.SCH_HIE_SCO_UID, |
STG.SCH_SRC_STATUS, |
NVL(DIM.MAX_SCH_DW_ID,0) |
FROM |
( |
SELECT |
STG.SCH_UID, |
STG.SCH_DESC, |
STG.SCH_IMPORT_UID, |
STG.SCH_GENERIC_UID, |
STG.SCH_HIE_ID, |
STG.SCH_HIE_UID, |
STG.SCH_HIE_DESC, |
STG.SCH_HIE_SCO_ID, |
STG.SCH_HIE_SCO_UID, |
'ACTIVE' AS SCH_SRC_STATUS |
FROM |
AA_XX_DEV01_STAGE.STG_ABC_CHANNELS STG |
MINUS |
SELECT |
STORE.SCH_UID, |
STORE.SCH_DESC, |
STORE.SCH_IMPORT_UID, |
STORE.SCH_GENERIC_UID, |
STORE.SCH_HIE_ID, |
STORE.SCH_HIE_UID, |
STORE.SCH_HIE_DESC, |
STORE.SCH_HIE_SCO_ID, |
STORE.SCH_HIE_SCO_UID, |
STORE.SCH_SRC_STATUS |
FROM |
AA_XX_DEV01_STORE.D_SALES_CHANNELS STORE) STG, |
|
(SELECT MAX( SCH_DW_ID) MAX_SCH_DW_ID FROM Be_MCC_DEV01_STORE.D_SALES_CHANNELS) DIM |