我正在尝试使用SQL Developer创建一个视图,但遇到了一个奇怪的错误。似乎缺少右括号,但我找不到哪里 - 你能帮我吗?
INPUT:
CREATE OR REPLACE VIEW MAST_SOMME_POINTS_CLUBS AS
(SELECT C.NOM, SUM(R.POINTS) AS POINTS
FROM MAST_CLUBS C
JOIN MAST_NAGEURS N USING(CLUB)
JOIN MAST_RESULTATS R USING(NRLIGUE)
GROUP BY (C.CLUB, C.NOM)
ORDER BY C.NOM);
输出:
Erreur commençant à la ligne: 1 de la commande -
CREATE OR REPLACE VIEW MAST_SOMME_POINTS_CLUBS AS
(SELECT C.NOM, SUM(R.POINTS) AS POINTS
FROM MAST_CLUBS C
JOIN MAST_NAGEURS N USING(CLUB)
JOIN MAST_RESULTATS R USING(NRLIGUE)
GROUP BY (C.CLUB, C.NOM)
ORDER BY C.NOM)
Rapport d'erreur -
Erreur SQL : ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
答案 0 :(得分:0)
请避免使用不必要的括号:
CREATE OR REPLACE VIEW MAST_SOMME_POINTS_CLUBS AS
SELECT
C.NOM,
SUM(R.POINTS) AS POINTS
FROM
MAST_CLUBS C
JOIN
MAST_NAGEURS N
USING (CLUB)
JOIN
MAST_RESULTATS R
USING (NRLIGUE)
GROUP BY
C.CLUB, -- Is this intentional? It is not in your SELECT
C.NOM
ORDER BY NOM;
作为提示:保持代码干净利落,结构良好有助于避免许多问题。