配置单元查询中缺少eof“”

v6ylcynt  于 2021-06-24  发布在  Hive
关注(0)|答案(1)|浏览(394)

我真的是sql的新手,这段代码是我以前的助手遗留下来的。
我正在使用配置单元查询,我在第53:65行遇到了一个缺少eof的问题
代码如下:

SELECT
'24-08-20' AS AS_OF_DATE,
'KRK' AS Flag,
B.COD_LOB AS LOB_CODE, 
A.COD_CUST AS CIF_KEY,
A.NAM_CUST_SHRT AS CUST_NAME,
CAST (A.COD_ACCT_NO AS CHAR(12)) as ACCOUNT_NUMBER,
' ' AS CONTRACT_REF_NO,
-------A.COD_CCY AS  CCY,
CASE A.COD_CCY WHEN 36 THEN 'AUD' WHEN 124 THEN 'CAD' WHEN 344 THEN 'HKD' WHEN 356 THEN 'INR' WHEN 360 THEN 'IDR'
WHEN 392 THEN 'JPY' WHEN 458 THEN 'MYR' WHEN 554 THEN 'NZD' WHEN 578 THEN 'NOK' WHEN 702 THEN 'SGD' WHEN 752 THEN 'SEK'
WHEN 756 THEN 'CHF' WHEN 764 THEN 'THB' WHEN 826 THEN 'GBP' WHEN 978 THEN 'EUR' WHEN 840 THEN 'USD' ELSE 'OTHER' END CCY,
cast (A.COD_PROD as char(10)) AS PRODUCT_CODE_NCBS,
cast (A.COD_PROD as char(10)) AS PROD_ICBS,
D.NAM_PRODUCT as  PRODUCT_DESC,
L.RAT_INT AS CUR_NET_RATE,
INT_VAR.RAT_VARIANCE AS RAT_VARIANCE,
'NULL' AS INDEX_RATE,
(CASE WHEN(INT_VAR.RAT_VARIANCE) IS NULL THEN L.RAT_INT ELSE (L.RAT_INT + INT_VAR.RAT_VARIANCE)END) AS NET_INTEREST,
rtrim(convert (DAT_ACCT_OPEN,111)) AS ACCOUNT_OPEN_DATE,
rtrim(convert(LINE_START_DATE,111)) AS ROLLOVER_DATE,
rtrim(convert(LINE_EXPIRY_DATE,111))AS MATURITY_DATE,
CAST (COD_ACCT_STAT AS CHAR(3)) AS ACCOUNT_STATUS,
rtrim(convert(LINE_EXPIRY_DATE,111))AS ACCOUNT_CLOSE_DATE,
B.COD_AO_BUSINESS AS AO_BUSINESS,
A.COD_CC_BRN AS BRANCH_CD,
C.cod_brn_type AS BRANCH_REGIONAL,
C.nam_branch AS BRANCH_DESCRIPTION,
(A.BAL_BOOK*-1) AS  BALANCE_ORI,
case when i.nam_ccy_short = 'IDR' and H.COD_CRR_TO>20 then (a.BAL_BOOK*-1)-tunggak.BUNGA_TUNGGAK else 
case when i.nam_ccy_short <> 'IDR' and H.COD_CRR_TO>20 then (a.BAL_BOOK*j.revrate*-1)-tunggak.BUNGA_TUNGGAK else 
case when i.nam_ccy_short = 'IDR' and H.COD_CRR_TO<=20 then (a.BAL_BOOK*-1) else (a.BAL_BOOK*j.revrate*-1) end end end as  BALANCE_IDR,
A.COD_LINE_NO AS CREDIT_LINE_ID,
G.RECORD_STAT AS LINE_STATUS,
M.dat_limit_start AS DATE_DISB,
G.LIMIT_AMOUNT AS  LIMIT_PLAFON_ORI,
case when i.nam_ccy_short = 'IDR' then (G.LIMIT_AMOUNT) else (G.LIMIT_AMOUNT*j.revrate) end  as  LIMIT_PLAFON_IDR,
H.COD_CRR_TO AS COLL,
'FCR-KRK-NCBS' AS SOURCE_DATA
-----------------------------------------
FROM (Select COD_CUST, NAM_CUST_SHRT,COD_ACCT_NO,COD_CCY,COD_PROD,COD_ACCT_STAT,COD_CC_BRN,BAL_BOOK,COD_LINE_NO,DAT_ACCT_OPEN from newmisplus2.BD_MIS_CH_ACCT_MAST where date_pr='20200824') A INNER JOIN (SELECT COD_PROD,COD_CCY,FLG_USE_TIERED_RATES_FOR_OD from newmisplus2.BD_CH_PROD_MAST WHERE COD_TYP_PROD='A' AND date_pr='20200824' ) X ON A.COD_PROD=X.COD_PROD AND A.COD_CCY=X.COD_CCY

LEFT JOIN (SELECT RAT_INT,COD_PROD from newmisplus2.BD_CH_INT_TAB WHERE COD_INT_TYPE='DR' AND date_pr='20200824') OD_DR ON A.COD_PROD=OD_DR.COD_PROD

LEFT JOIN (SELECT RAT_INT,COD_PROD from newmisplus2.BD_CH_INT_TAB WHERE COD_INT_TYPE='OL' AND date_pr='20200824') OD_OL ON A.COD_PROD=OD_OL.COD_PROD

LEFT JOIN (SELECT RAT_VARIANCE,COD_ACCT_NO from newmisplus2.BD_MIS_CH_ACCT_CUR_VARIANCE WHERE COD_INT_TYPE = 'DR' AND date_pr='20200824') INT_VAR 
ON A.COD_ACCT_NO=INT_VAR.COD_ACCT_NO

LEFT JOIN
(SELECT A.COD_LIMIT_NO,AMT_LIMIT,RAT_INT_EFFECTIVE,A.COD_ACCT_NO from newmisplus2.BD_CH_OD_LIMIT where date_pr='20200824') A
INNER JOIN (SELECT COD_ACCT_NO,MAX(COD_LIMIT_NO) AS COD_LIMIT_NO from newmisplus2.BD_CH_OD_LIMIT where date_pr='20200824' GROUP BY COD_ACCT_NO) B
ON A.COD_ACCT_NO=B.COD_ACCT_NO AND A.COD_LIMIT_NO=B.COD_LIMIT_NO OD_INT_EFF ON A.COD_ACCT_NO=OD_INT_EFF.COD_ACCT_NO
-----------------------------------------

有没有修改剧本的建议?谢谢你

xzv2uavs

xzv2uavs1#

也许还有更多的问题。我发现:

LEFT JOIN
(SELECT A.COD_LIMIT_NO,AMT_LIMIT,RAT_INT_EFFECTIVE,A.COD_ACCT_NO from newmisplus2.BD_CH_OD_LIMIT where date_pr='20200824') A
INNER JOIN (SELECT COD_ACCT_NO,MAX(COD_LIMIT_NO) AS COD_LIMIT_NO from newmisplus2.BD_CH_OD_LIMIT where date_pr='20200824' GROUP BY COD_ACCT_NO) B
ON A.COD_ACCT_NO=B.COD_ACCT_NO AND A.COD_LIMIT_NO=B.COD_LIMIT_NO OD_INT_EFF ON A.COD_ACCT_NO=OD_INT_EFF.COD_ACCT_NO
``` `A` 子查询具有相同的名称 `A` 作为from之后的第一个子查询,它也没有on条件

相关问题