缺少右括号SQL - *

时间:2016-07-19 20:10:44

标签: sql oracle



我在使用这段代码时遇到了问题,因为它说的是第22行的错误 ORA-00907:当我执行它时缺少右括号。

SELECT DC.ACJ_ID,
           DC.MCI_UNIQ_ID,
           DG.GENDER_COMMON_DESC,
           DR.RACE_COMMON_DESC,
           AD.ADDRESS_LINE_1,
           AD.ADDRESS_LINE_2,
           AD.CITY,
           AD.STATE,
           AD.ZIP_CD,
           AD.ZIP_CD_9,
           DC_RANK
      FROM DW_CLNTVIEW.FACT_CLIENT_WEEK_LATEST FCAS,
           DW.DIM_GENDER DG,
           DW.DIM_RACE DR,
           DW.DIM_ADDRESS AD,
           KLISA.JAIL_IDS DOC,
           (SELECT ACJ_ID,
                   MCI_UNIQ_ID,
                   DENSE_RANK ()
                   OVER (PARTITION BY ACJ_ID
                         ORDER BY END_DATE DESC, EFF_DATE DESC, MCI_UNIQ_ID DESC ---REMOVE “MCI_UNIQ_ID DESC” TO ALLOW DUPLICATES ON ACJ_ID
                      DC_RANK
              FROM DW.DIM_CLIENT) DC
    WHERE     FCAS.RACE_KEY = DR.RACE_KEY(+)
           AND FCAS.SRC_SYS_KEY(+) = 0
           AND FCAS.GENDER_KEY = DG.GENDER_KEY(+)
           AND FCAS.ADDRESS_KEY = AD.ADDRESS_KEY(+)
           AND DC.MCI_UNIQ_ID = FCAS.MCI_UNIQ_ID(+)
           AND ACJS.ACJ_ID = DC.ACJ_ID(+)
           AND DC_RANK(+) = 1;

1 个答案:

答案 0 :(得分:2)

你有不平衡的括号。

(SELECT ACJ_ID,

 OVER (PARTITION BY ACJ_ID

另一个离开了。

FROM DW.DIM_CLIENT) DC

关闭一对。

因此留下一个开放。