Hi ,
I'm a newbie to Teradatae , tyring to fine tune this piece of code, but getting the 3706 error in Teradata.
Here is the code,please help...
SEL APPS_ABBOTT_CUSTOMER_ID, IC_ABBOTT_CUSTOMER_ID FROM (
(SEL DISTINCT IC.RULE_PACKAGE_VERSION_ID, ABBOTT_CUSTOMER_ID AS IC_ABBOTT_CUSTOMER_ID , IMS_NUMBER
FROM IC_UNIVERSE_ALIGNED IC
INNER JOIN BRR_BATCH_RULE_PACKAGE P on IC.RULE_PACKAGE_VERSION_ID = P.RULE_PACKAGE_VERSION_ID
AND P.BRR_BATCH_ID = CAST ('$$BRR_BATCH_ID' AS DECIMAL)
WHERE IC.DDS_ACTIVE_FLAG = 'Y'
--AND IC.DATA_MONTH = CAST('$$DATA_MONTH' AS DATE FORMAT 'MM/DD/YYYY')
AND IC.INC_COMPN_ELIGIBILITY_FLAG = 'Y'
AND IC.IMS_NUMBER IS NOT NULL
AND IC.IMS_NUMBER <> '') AS X,
(SEL DISTINCT C.RULE_PACKAGE_VERSION_ID, ABBOTT_CUSTOMER_ID AS APPS_ABBOTT_CUSTOMER_ID, IMS_NUMBER
FROM DDSP.APPS_UNIVERSE_THIN A
INNER JOIN IC_UNIVERSE_RULE C on A.VERSION_ID = C.DDS_APPS_VERSION_ID
and C.DDS_ACTIVE_FLAG = 'Y'
INNER JOIN BRR_BATCH_RULE_PACKAGE P on C.RULE_PACKAGE_VERSION_ID = P.RULE_PACKAGE_VERSION_ID
AND P.BRR_BATCH_ID = CAST ('$$BRR_BATCH_ID' AS DECIMAL)
WHERE A.DDS_ACTIVE_FLAG = 'Y'
AND IC.IMS_NUMBER IS NOT NULL
AND IC.IMS_NUMBER <> '') AS Y
WHERE X.RULE_PACKAGE_VERSION_ID = X.RULE_PACKAGE_VERSION_ID
AND X.IMS_NUMBER = Y.IMS_NUMBER
AND X.ABBOTT_CUSTOMER_ID <> Y.ABBOTT_CUSTOMER_ID)
UNION
(SEL DISTINCT IC.RULE_PACKAGE_VERSION_ID, ABBOTT_CUSTOMER_ID AS IC_ABBOTT_CUSTOMER_ID, MAX_ID
FROM IC_UNIVERSE_ALIGNED IC
INNER JOIN BRR_BATCH_RULE_PACKAGE P on IC.RULE_PACKAGE_VERSION_ID = P.RULE_PACKAGE_VERSION_ID
AND P.BRR_BATCH_ID = CAST ('$$BRR_BATCH_ID' AS DECIMAL)
WHERE IC.DDS_ACTIVE_FLAG = 'Y'
--AND IC.DATA_MONTH = CAST('$$DATA_MONTH' AS DATE FORMAT 'MM/DD/YYYY')
AND IC.INC_COMPN_ELIGIBILITY_FLAG = 'Y'
AND (IC.IMS_NUMBER IS NULL OR IC.IMS_NUMBER = '')) AS X,
(SEL DISTINCT C.RULE_PACKAGE_VERSION_ID, ABBOTT_CUSTOMER_ID AS APPS_ABBOTT_CUSTOMER_ID, MAX_ID
FROM DDSP.APPS_UNIVERSE_THIN A
INNER JOIN IC_UNIVERSE_RULE C on A.VERSION_ID = C.DDS_APPS_VERSION_ID
and C.DDS_ACTIVE_FLAG = 'Y'
INNER JOIN BRR_BATCH_RULE_PACKAGE P on C.RULE_PACKAGE_VERSION_ID = P.RULE_PACKAGE_VERSION_ID
AND P.BRR_BATCH_ID = CAST ('$$BRR_BATCH_ID' AS DECIMAL)
WHERE A.DDS_ACTIVE_FLAG = 'Y'
AND (IC.IMS_NUMBER IS NULL OR IC.IMS_NUMBER = '')) AS Y
WHERE X.RULE_PACKAGE_VERSION_ID = X.RULE_PACKAGE_VERSION_ID
AND X.MAX_ID = Y.MAX_ID
AND X.ABBOTT_CUSTOMER_ID <> Y.ABBOTT_CUSTOMER_ID));
↧