我有以下语句返回了上述905错误。有什么想法吗?
CREATE MATERIALIZED VIEW SYNT_CE CACHE USING INDEX REFRESH ON DEMAND FORCE USING DEFAULT ROLLBACK SEGMENT DISABLE QUERY REWRITE
AS
WITH SYNT_AV AS (SELECT CIRC_BV, CASE WHEN SUM(C_AVANCEMENT) > 1 THEN 'non transmis' WHEN SUM(C_AVANCEMENT) = 1 THEN 't�l�phon�' ELSE 'confirm�' END AS C_AVANCEMENT
FROM (SELECT SYNT_BV.CIRC_BV, (CASE SYNT_BV.C_AVANCEMENT WHEN 'non transmis' THEN 2 WHEN 't�l�phon�' THEN 1 WHEN 'confirm�' THEN 0 END) AS C_AVANCEMENT
FROM SYNT_BV GROUP BY SYNT_BV.CIRC_BV, (CASE SYNT_BV.C_AVANCEMENT WHEN 'non transmis' THEN 2 WHEN 't�l�phon�' THEN 1 WHEN 'confirm�' THEN 0 END)) AV GROUP BY CIRC_BV)
SELECT TO_NUMBER(SYNT_BV.CIRC_BV) AS C_CE, SYNT_BV.CIRC_BV, SYNT_BV.CIRC_BV, SYNT_BV.CIRC_BV || case WHEN SYNT_BV.CIRC_BV = '01' then 'er Ardt' WHEN SYNT_BV.CIRC_BV <> '01' then 'ème Ardt' as L_CIRC_BV, SYNT_BV.NUMERO_TOUR, SYNT_BV.NUMERO_TOUR, SYNT_BV.DATE_TOUR, SYNT_BV.TYPE_ELECTION, SYNT_BV.LIBELLE_ELECTION,
SUM(SYNT_BV.NB_INSCRIT) AS NB_INSCRIT,
SUM(SYNT_BV.NB_VOTANT) AS NB_VOTANT,
SUM(SYNT_BV.NB_EMARGEMENT) AS NB_EMARGEMENT,
SUM(SYNT_BV.NB_PROCURATION) AS NB_PROCURATION,
SUM(SYNT_BV.NB_EXPRIME) AS NB_EXPRIME,
SUM(SYNT_BV.NB_VOTE_BLANC) AS NB_VOTE_BLANC,
SUM(SYNT_BV.NB_VOTE_NUL) AS NB_VOTE_NUL,
SUM(SYNT_BV.NB_VOTE_B_NUL) AS NB_VOTE_B_NUL,
SUM(SYNT_BV.NB_VOTE_B_NUL_ABS) AS NB_VOTE_B_NUL_ABS,
[...]
ORDER BY SYNT_BV.ARR_BV;
CREATE INDEX SYNT_AR_INDEX_C_CAINSEE ON SYNT_AR (C_CAINSEE ASC);
答案 0 :(得分:3)
使用此:
CREATE MATERIALIZED VIEW SYNT_CE CACHE USING INDEX REFRESH ON DEMAND FORCE USING DEFAULT ROLLBACK SEGMENT DISABLE QUERY REWRITE
AS
WITH SYNT_AV AS (SELECT CIRC_BV, CASE WHEN SUM(C_AVANCEMENT) > 1 THEN 'non transmis' WHEN SUM(C_AVANCEMENT) = 1 THEN 't�l�phon�' ELSE 'confirm�' END AS C_AVANCEMENT
FROM (SELECT SYNT_BV.CIRC_BV, (CASE SYNT_BV.C_AVANCEMENT WHEN 'non transmis' THEN 2 WHEN 't�l�phon�' THEN 1 WHEN 'confirm�' THEN 0 END) AS C_AVANCEMENT
FROM SYNT_BV GROUP BY SYNT_BV.CIRC_BV, (CASE SYNT_BV.C_AVANCEMENT WHEN 'non transmis' THEN 2 WHEN 't�l�phon�' THEN 1 WHEN 'confirm�' THEN 0 END)) AV GROUP BY CIRC_BV)
SELECT TO_NUMBER(SYNT_BV.CIRC_BV) AS C_CE, SYNT_BV.CIRC_BV, SYNT_BV.CIRC_BV, SYNT_BV.CIRC_BV || case WHEN SYNT_BV.CIRC_BV = '01' then 'er Ardt' WHEN SYNT_BV.CIRC_BV <> '01' then 'ème Ardt' END as L_CIRC_BV, SYNT_BV.NUMERO_TOUR, SYNT_BV.NUMERO_TOUR, SYNT_BV.DATE_TOUR, SYNT_BV.TYPE_ELECTION, SYNT_BV.LIBELLE_ELECTION,
SUM(SYNT_BV.NB_INSCRIT) AS NB_INSCRIT,
SUM(SYNT_BV.NB_VOTANT) AS NB_VOTANT,
SUM(SYNT_BV.NB_EMARGEMENT) AS NB_EMARGEMENT,
SUM(SYNT_BV.NB_PROCURATION) AS NB_PROCURATION,
SUM(SYNT_BV.NB_EXPRIME) AS NB_EXPRIME,
SUM(SYNT_BV.NB_VOTE_BLANC) AS NB_VOTE_BLANC,
SUM(SYNT_BV.NB_VOTE_NUL) AS NB_VOTE_NUL,
SUM(SYNT_BV.NB_VOTE_B_NUL) AS NB_VOTE_B_NUL,
SUM(SYNT_BV.NB_VOTE_B_NUL_ABS) AS NB_VOTE_B_NUL_ABS,
[...]
ORDER BY SYNT_BV.ARR_BV;
CREATE INDEX SYNT_AR_INDEX_C_CAINSEE ON SYNT_AR (C_CAINSEE ASC);
您在CASE语句末尾错过了 END 一词。