SQL ORA-00933命令未正确结束

时间:2016-12-14 14:39:18

标签: sql oracle error-handling oracle-sqldeveloper

我对SQL很陌生,希望你能提供帮助。

我从同事那里继承了一些脚本。谁不再在身边问。

我收到的ORA-00933命令未正确结束

行错误:13列:96

见下面的错误图片

enter image description here

我的代码如下。任何帮助总是非常感激。

代码

(select coalesce ("DTOVS".MDM_DMN_GEO_CD,"ITOVS".MDM_DMN_GEO_CD)as "MDM_DMN_GEO_CD" 
,coalesce("DTOVS".info_src_cd,"ITOVS".info_src_cd) as "INFO_SRC_CD"
,coalesce("DTOVS"."Total DToVs"+"ITOVS"."Total IToVs","DTOVS"."Total DToVs","ITOVS"."Total IToVs",0) as "TOTAL TOVS" from 
(select count(distinct src_party_id) as "Total DToVs", MDM_DMN_GEO_CD,Info_src_cd from efpia.cust_expns
    where HDD_STATUS_CD='N' and expns_dt<TO_DATE('01/01/2016','dd/mm/yyyy') group by MDM_DMN_GEO_CD,Info_Src_Cd) "DTOVS"
full outer join
(select count(distinct src_party_id) as "Total IToVs", MTNG_BDGT_EXPNS.MDM_DMN_GEO_CD,MTNG_BDGT_EXPNS.Info_src_cd 
from efpia.MTNG_BDGT_EXPNS 
inner join EFPIA.MTNG on (MTNG_BDGT_EXPNS.SRC_MTNG_ID=MTNG.SRC_MTNG_ID and MTNG_BDGT_EXPNS.MDM_DMN_GEO_CD=MTNG.MDM_DMN_GEO_CD
    and MTNG_BDGT_EXPNS.INFO_SRC_CD=MTNG.INFO_SRC_CD)
where MTNG_BDGT_EXPNS.HDD_STATUS_CD = 'N' and MTNG_STRT_DT < TO_DATE('01/01/2016','dd/mm/yyyy')
group by MTNG_BDGT_EXPNS.MDM_DMN_GEO_CD,MTNG_BDGT_EXPNS.Info_Src_Cd)  "ITOVS"
on ("DTOVS".MDM_DMN_GEO_CD="ITOVS".MDM_DMN_GEO_CD and "DTOVS".Info_src_cd="ITOVS".info_src_cd)) "TOTAL"

我认为错误发生在这一行

on ("DTOVS".MDM_DMN_GEO_CD="ITOVS".MDM_DMN_GEO_CD and "DTOVS".Info_src_cd="ITOVS".info_src_cd)) "TOTAL"

但我无法确定:-)

1 个答案:

答案 0 :(得分:2)

这是代码的一部分?因为如果不是你不需要先(并从脚本末尾删除 - ) "TOTAL""