Отсутствующее ключевое слово (ora-00905) - ошибка sql: ora-00905

У меня есть приведенное ниже заявление, которое возвращает вышеупомянутую ошибку 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);

Похоже, у вас есть select без from или group by. Сложно разобраться в проблеме. Я бы посоветовал упростить, упростить, упростить, пока вы не изолируете ошибку и не исправите ее.

Gordon Linoff 10.08.2018 15:51

Синтаксические ошибки легче обнаружить, если код написан правильно и в смешанном случае. Из-за того, что ваши строки настолько длинные, что нам нужно использовать полосы прокрутки, нам очень сложно определить, какие шаровары вы могли сделать. Читаемость - это функция, которую должен иметь ваш код.

APC 10.08.2018 16:27
1
2
225
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Использовать этот:

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.

Другие вопросы по теме