Error when Create Materialized View

Hi
When I tried to create MV show me error :
SQL> @CRIA_MV_ARC_BW.SQL
AND INDUSTRIAL.CD_FABRICA = SUBSTR(ARC.DS_ARC, 1, 3)
ERROR at line 88:
ORA-01031: insufficient privilegesI am using Oracle 9.02 and there are Grant for all Tablles , my query of creation is:
CREATE MATERIALIZED VIEW CLIBGF.MV_ARC_BW
NOCACHE
LOGGING
NOPARALLEL
BUILD IMMEDIATE
REFRESH FORCE
START WITH TO_DATE('26-nov-2009 02:00:00','dd-mon-yyyy hh24:mi:ss')
NEXT trunc(sysdate) + 1/12
ENABLE QUERY REWRITE
AS
SELECT     MAX(NVL((SELECT  DECODE(A.T$CDNG$O,'F',DECODE(TRIM(B.T$CALC$O),'S','C',A.T$CDNG$O),A.T$CDNG$O)
                 FROM TRITON.TTDFAT995501 A, TRITON.TTDFAT996501 B
                WHERE A.T$OCOM$O + 0 = ARC.CD_UNIDADE_EXPEDIDORA
                  AND A.T$NDOC$O = NOTAS.CD_NOTA
                  AND (A.T$OCOM$O = B.T$OCOM$O AND A.T$NREF$O = B.T$NREF$O)
                                    AND ROWNUM =1),
               0)) NEGOCIO,
       ARC.CD_CLIENTE CD_CLIENTE,
       CLIENTE.T$NAMA DS_CLIENTE,
       ARC.CD_ARC,
       ARC.CD_STATUS,
       ARC.CD_STATUS || ' - ' || STATUS.DS_STATUS STATUS,
       TO_CHAR(ARC.DT_EMISSAO, 'DD/MM/YYYY') DT_EMISSAO,
       TO_CHAR(ACAO_INV.DT_REALIZADO, 'DD/MM/YYYY') DT_REALIZADO_INVESTIGACAO,
       ARC.CD_MARCA || ' - ' || MARCA.T$DSMA$O MARCA,
       ARC.CD_PRODUTO CD_PRODUTO,
       EMBALAGEM.T$CDAC$O || ' - ' || EMBALAGEM.T$DESC$O DS_EMBALAGEM,
       SUBSTR(ARC.DS_ARC, 1, 3) CD_COMPANHIA_PRODUTORA,
        ARC.CD_MOTIVO_RECLAMACAO CD_MOTIVO_RECLAMACAO,
        MOTIVO.DS_ITEM DS_MOTIVO_RECLAMACAO,
       DECODE(ARC.FL_PROCEDENCIA, 0, 'PROCEDENTE', 1, 'IMPROCEDENTE', ' ') PROCEDENCIA,
       SUM(NVL((SELECT SUM(NVL(T$IQUA$O, 0))
                 FROM TRITON.TTDFAT995501 A, TRITON.TTDFAT996501 B
                WHERE A.T$OCOM$O + 0 = ARC.CD_UNIDADE_EXPEDIDORA
                  AND A.T$NDOC$O = NOTAS.CD_NOTA
                  AND (A.T$OCOM$O = B.T$OCOM$O AND A.T$NREF$O = B.T$NREF$O)),
               0)) NR_QUANTIDADE_VENDIDA,
           ARC.NR_QUANTIDADE_AFETADA NR_QUANTIDADE_AFETADA,     
       ARC.NR_QUANTIDADE_AFETADA_REAL NR_QUANTIDADE_AFETADA_REAL,
       DS_JUSTIFICATIVA DSJUST
  FROM ARCTB_ARC                 ARC,
       ARCTB_NOTAS               NOTAS,
       ARCTB_TABELA_MOTIVO       MOTIVO,
       ARCTB_ACAO_IMEDIATA       ACAO_INV,
       ARCTB_ACAO_IMEDIATA       ACAO_IME,
       ARCTB_STATUS              STATUS,
       TRITON.TTCCOM010501       CLIENTE,
       TRITON.TTCCOM936501       CIDADE,
       TRITON.TTIITM001810       D,
       TRITON.TTIITM983501       PRODUTO,
       TRITON.TTFGLD010806       CC,
       TRITON.TTCCOM983501       MARCA,
       TRITON.TTCCOM000501       CIA,
       TRITON.TTIITM982501       NAT,
       SEI.SIBTB_MULTIMARCA      MULTIMARCA,
       SEI.SIBTB_DIRETORIA_DEPTO DIRETORIA,
       TRITON.TTCCOM994501       USUARIO,
       ARCTB_GERENCIA_INDUSTRIAL INDUSTRIAL,
       TRITON.TTIITM984501       EMBALAGEM
WHERE ARC.CD_ARC = NOTAS.CD_ARC(+)
   AND ARC.CD_ARC = ACAO_INV.CD_ARC(+)
   AND ACAO_INV.CD_TIPO_ACAO(+) = 0
   AND ACAO_INV.CD_ACAO_IMEDIATA(+) = 999
   AND ARC.CD_ARC = ACAO_IME.CD_ARC(+)
   AND ACAO_IME.CD_TIPO_ACAO(+) = 1
   AND ACAO_IME.CD_ACAO_IMEDIATA(+) = 999
   AND ARC.CD_CLIENTE = CLIENTE.T$CUNO(+)
   AND CLIENTE.T$ESTA$L = CIDADE.T$ESTA$L(+)
   AND CLIENTE.T$CDMU$L = CIDADE.T$MUNI$L(+)
   AND TRIM(REPLACE(ARC.CD_PRODUTO, '-', '')) =
       TRIM(REPLACE(D.T$ITEM(+), '-', ''))
   AND TRIM(REPLACE(ARC.CD_PRODUTO, '-', '')) =
       TRIM(REPLACE(PRODUTO.T$ITEM$O(+), '-', ''))
   AND PRODUTO.T$PROC$O = NAT.T$PROC$O(+)
   AND EMBALAGEM.T$CDAC$O(+) = PRODUTO.T$CDAC$O
   AND ARC.CD_MOTIVO_RECLAMACAO = MOTIVO.CD_ITEM(+)
   AND ARC.CD_MARCA = MARCA.T$CDMA$O(+)
   AND SUBSTR(ARC.DS_ARC, 1, 3) = CIA.T$NCMP(+)
   AND ARC.CD_STATUS = STATUS.CD_STATUS(+)
   AND TRIM(ARC.CD_CENTRO_CUSTO) = TRIM(CC.T$DIMX(+))
   AND CC.T$DTYP(+) = 2
   AND CC.T$SUBL(+) = 0
   AND ARC.CD_DEPTO_MULTIMARCA = MULTIMARCA.CD_MULTIMARCA(+)
   AND ARC.CD_DEPTO = DIRETORIA.CD_DEPTO(+)
   AND ARC.CD_USUARIO = TRIM(USUARIO.T$CDUS$O(+))
   AND ARC.CD_STATUS IS NOT NULL
   AND ARC.CD_MOTIVO_RECLAMACAO = MOTIVO.CD_ITEM(+)
   AND INDUSTRIAL.CD_FABRICA = SUBSTR(ARC.DS_ARC, 1, 3)
   GROUP BY TO_CHAR(ARC.DT_EMISSAO, 'YYYY'),
          TO_CHAR(ARC.DT_EMISSAO, 'MM'),
          ARC.CD_ARC,
          ARC.DS_ARC,
          ARC.DS_SUPERVISOR,
          ARC.CD_STATUS,
          STATUS.DS_STATUS,
          TO_CHAR(ARC.DT_EMISSAO, 'DD/MM/YYYY'),
          TO_CHAR(ACAO_INV.DT_ORIGINAL, 'DD/MM/YYYY'),
          TO_CHAR(ACAO_INV.DT_REALIZADO, 'DD/MM/YYYY'),
          TO_CHAR(ACAO_IME.DT_ORIGINAL, 'DD/MM/YYYY'),
          TO_CHAR(ACAO_IME.DT_REALIZADO, 'DD/MM/YYYY'),
          TO_CHAR(ARC.DT_PROCEDENCIA, 'DD/MM/YYYY'),
          TO_CHAR(ARC.DT_RECEBIMENTO, 'DD/MM/YYYY'),
          TO_CHAR(NVL(ARC.DT_APROVACAO_INDUSTRIAL,
                      ARC.DT_APROVACAO_COMERCIAL),
                  'DD/MM/YYYY'),
          ARC.CD_CLIENTE,
          CLIENTE.T$NAMA,
          CIDADE.T$DSCA$L,
          ARC.CD_MARCA,
          MARCA.T$DSMA$O,
          ARC.CD_PRODUTO,
          D.T$SEAK,
          EMBALAGEM.T$CDAC$O || ' - ' || EMBALAGEM.T$DESC$O,
          NAT.T$DESC$O,
          ARC.NR_LOTE,
          ARC.DT_FABRICACAO,
          SUBSTR(ARC.DS_ARC, 1, 3),
          CIA.T$CITY,
          ARC.CD_MOTIVO_RECLAMACAO,
          MOTIVO.DS_ITEM,
          DECODE(ARC.FL_PROCEDENCIA,
                 0,
                 'PROCEDENTE',
                 1,
                 'IMPROCEDENTE',
          ARC.DS_DISPOSICAO,
          ARC.CD_CENTRO_CUSTO,
          CC.T$DESC,
          ARC.NR_QUANTIDADE_AFETADA,
          DS_JUSTIFICATIVA,
          DS_DISPOSICAO,
          CD_RESPONSAVEL_CAUSA,
          ARC.NR_QUANTIDADE_AFETADA_REAL,
          ARC.DT_ATENDIMENTO,
          MOTIVO.CLASSIFICACAO,
          ARC.DS_COORDENADOR,
          ARC.FL_ATENDIMENTO,
          TO_CHAR(ARC.DT_ATENDIMENTO, 'DD/MM/YYYY'),
          ARC.DS_COORDENADOR_INVESTIGACAO,
          INDUSTRIAL.REGIAO
ORDER BY ARC.CD_ARC DESC;
Edited by: muttleychess on Nov 25, 2009 10:25 AM

Please see my privilege
GRANTEE PRIVILEGE ADM
CLIBGF CREATE TABLE NO
CLIBGF CREATE ANY VIEW NO
CLIBGF CREATE SNAPSHOT NO
CLIBGF SELECT ANY TABLE NO
CLIBGF CREATE ANY TRIGGER NO
CLIBGF CREATE ANY SNAPSHOT NO

Similar Messages

  • Error while creating materialized view which using database link

    Helo!
    I'm getting error "ORA-00942: table or view does not exist" when I want to create materialized view.
    Details:
    1. On destination database I create a database link:
    CREATE DATABASE LINK SDATABASE
    CONNECT TO MYUSER
    IDENTIFIED BY MYUSERPASS
    USING 'ORCL';
    => Command "SELECT * FROM TABLE1@SDATABASE" returns data normally!
    2. On source database I create MATERIALIZED VIEW LOG:
    CREATE MATERIALIZED VIEW LOG
    ON TABLE1
    WITH PRIMARY KEY
    INCLUDING NEW VALUES;
    3. Now, when I want to create MATERIALIZED VIEW on destination database:
    CREATE MATERIALIZED VIEW TABLE1
    REFRESH FAST
    START WITH SYSDATE
    NEXT SYSDATE + 1/1440
    WITH PRIMARY KEY
    AS SELECT * FROM TABLE1@SDATABASE;
    ...I get error "ORA-00942: table or view does not exist"!
    How is that possible if command "SELECT * FROM TABLE1@SDATABASE" returns data normally?
    Thanks,
    Voranc

    And, I'm using Oracle 10g.
    Voranc

  • Error on creating Materialized view.

    Hi,
    I don't understand why it happens...
    When I tried to creating materialized view, it shows a error "ORA-01013: User requested cancel of current operation".
    I don't understand why it happens. I just waited it successfully created. But I didn't press any button.
    Does it matter of size of joining table? I had same issue before. At that time I just removed some tables from the joining condition, this error was gone.
    But at this time, I cannot exclude any other tables the select statement
    Can anyone help me this issue, please?

    Hi,
    11g ( 11.2.0.3 ) has a problem with materialized views based on ROWID, resulting in the problem you mentioned.
    A workaround is creating the MV's based on primary keyl.
    There is also a patch available on MOS, to solve the problem ( thanks to a very long SR from me :-) )
    It is known as bug 13657605 and the patch for it has the same number.
    Remember to read the README, as this patch is only for 11.2.0.3 !!
    Cheers
    FJFranken

  • Error while creating Materialized View in AWM

    Hello,
    I am using Oracle 11g with Analytic WorkSpace Manager 11.1.0.6.0A
    I am trying to create materialized view on my Cube..
    The Cube has 5 Dimensions out of which Four are having two levels i.e.,
    TotalA-->DimensionA
    TotalB-->DimensionB...and so on
    And one time Dimension having 4 levels
    TotalTime-->YEAR-->QUARTER-->MONTH
    When i try to create the materialized view, i get an error saying that
    "Your metadata changes have been saved, with the following errors
    CREATE MATERIALIZED VIEW "ENT.CB$TIME_TIME_HIER"
    ORA-02267:column type incompatible with referenced column type"
    When i googled regarding this error, it says to change the datatype of the column..
    But which column's data type is to be changed..Please throw some light regarding this...
    Awaiting for reply..

    My query is as follows:
    SELECT
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LONG_DESCRIPTION='product1'AND l.level_name='ALL_MODE'AND m.LONG_DESCRIPTION = 'Type1' )then 1 else 0 end)) as Cumm_product1_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LONG_DESCRIPTION='product1'AND l.level_name='ALL_MODE'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_product1_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode1'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_Mode1_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode1'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode1_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode2'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_CLRING_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode2'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode2_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode3'AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_TRSFER_Type1Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.LONG_DESCRIPTION='Mode3'AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_Mode3_Type2Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.level_name='ALL_MODE' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.long_description='Mode3' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Mode3_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.LEVEL_NAME = 'ALL_product' AND l.long_description='Mode2' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_Mode2_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.level_name='ALL_MODE' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_product1_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.LONG_DESCRIPTION = 'Type1')then 1 else 0 end)) as Cumm_product1Mode1Type1_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.LONG_DESCRIPTION = 'Type2')then 1 else 0 end)) as Cumm_product1_Mode1_Type2_Txn_Amount,
    sum(cd.SALESAMT *(case when (k.long_description = 'product1' AND l.long_description='Mode1' AND m.level_name = 'ALL_TYPE')then 1 else 0 end)) as Cumm_product1_Mode1_Total_Txn_Amount
    /* From dimension views and cube view */
    FROM CUSTOMER_ID_CUSTOMER_ID_HIE_VIEW b,
    TIME_TIME_HIER_VIEW j,
    product_product_HIER_VIEW k,
    MODE_MODE_HIER_VIEW l,
    TYPE_TYPE_HIER_VIEW m,
    CUBETEST_VIEW cd
    /* Create level filters */
    WHERE b.level_name = 'CUSTOMER_ID'
    AND b.LONG_DESCRIPTION='xyz'
    AND j.LEVEL_NAME='MONTH'
    AND j.END_DATE between to_date('2007-10-31','YYYY-MM-DD') and to_date('2007-10-31','YYYY-MM-DD')
    /* Join dimension views to cube view */
    AND b.DIM_KEY=cd.ACCOUNT_ID
    AND j.DIM_KEY=cd.TIME
    AND k.DIM_KEY=cd.product
    AND l.DIM_KEY=cd.MODE
    AND m.DIM_KEY=cd.TYPE
    ORDER BY j.end_date,
    k.level_name,
    l.level_name,
    m.level_name;

  • Error on "CREATE MATERIALIZED VIEW"

    I tried to create this materialized view:
    CREATE MATERIALIZED VIEW mv_cost_est
    BUILD IMMEDIATE
    REFRESH complete
    START WITH to_date(sysdate,'dd/mm/yyyy hh24:mi:ss')
    NEXT sysdate + 60/86400
    disable QUERY REWRITE
    AS
    SELECT
    efm_contratti.contratto_id,
    efm_commesse.dp_id,
    x.wr_id,
    (select max(cost_class_attiva) from efm_cost_cat_passivo_attivo
    where x.cost_class_id = efm_cost_cat_passivo_attivo.cost_class_passiva
    and x.cost_cat_id = efm_cost_cat_passivo_attivo.cost_cat_passiva
    ) AS classe_costo,
    (select max(cost_cat_attiva) from efm_cost_cat_passivo_attivo
    where x.cost_cat_id = efm_cost_cat_passivo_attivo.cost_cat_passiva
    and x.cost_class_id = efm_cost_cat_passivo_attivo.cost_class_passiva) as cat_costo,
    x.cost_est_total,
    (SELECT CASE
    WHEN status IN ('I','SA') and ( (TO_DATE(LAST_DAY(SYSDATE)) > wr.date_est_start) or wr.pct_complete > 0 ) THEN
    (case
    when wr.pct_complete > 0 then
    (wr.cost_est_total * wr.pct_complete /100 * (1 + pct_ricarico/100))
    when (wr.pct_complete = 0 and wr.date_est_end = wr.date_est_start and wr.date_est_end < TO_DATE(LAST_DAY(SYSDATE))) then
    (wr.cost_est_total * (1 + pct_ricarico/100))
    when (wr.pct_complete = 0 and wr.date_est_end > TO_DATE(LAST_DAY(SYSDATE)) ) then
    (wr.cost_est_total * ((TO_DATE(LAST_DAY(SYSDATE)) - wr.date_est_start) / (wr.date_est_end - wr.date_est_start) ) * (1 + pct_ricarico/100))
    when (wr.pct_complete = 0 and wr.date_est_end < TO_DATE(LAST_DAY(SYSDATE)) ) then
    (wr.cost_est_total * (1 + pct_ricarico/100))
    when (wr.pct_complete = 0 and wr.date_est_end = TO_DATE(LAST_DAY(SYSDATE))) then
    (wr.cost_est_total * (1 + pct_ricarico/100))
    END)
    WHEN status = 'Com' THEN cost_est_total * (1 + pct_ricarico/100)
    WHEN status = 'CON' THEN cost_total * (1 + pct_ricarico/100)
    WHEN status = 'BEN' THEN cost_total * (1 + pct_ricarico/100)
    else
    0
    end
    from wr where wr.wr_id=x.wr_id) as IMPORTO1,
    'EUR',
    efm_commesse.ac_id,
    project.project_id,
    project.project_type,
    x.status,
    x.cost_est_total,
    x.cost_total,
    x.pct_complete,
    (SELECT CASE
    WHEN status IN ('I','SA') THEN
    (case
    when wr.pct_complete = 0 and wr.date_est_start = wr.date_est_end and wr.date_est_end < TO_DATE(LAST_DAY(SYSDATE)) then
    100
    when wr.pct_complete = 0 and wr.date_est_end > TO_DATE(LAST_DAY(SYSDATE)) then
    round (((TO_DATE(LAST_DAY(SYSDATE)) - wr.date_est_start) / (wr.date_est_end - wr.date_est_start)*100), 2)
    when wr.pct_complete = 0 and wr.date_est_end < TO_DATE(LAST_DAY(SYSDATE)) then
    100
    when wr.pct_complete = 0 and wr.date_est_end = TO_DATE(LAST_DAY(SYSDATE)) then
    100
    when wr.pct_complete > 0 then
    wr.pct_complete
    END)
    WHEN status = 'Com' THEN 100
    WHEN status = 'CON' THEN 100
    WHEN status = 'BEN' THEN 100
    else
    0
    end
    from wr where wr.wr_id=x.wr_id) as SAL_CALCOLATO,
    x.pct_ricarico,
    x.commessa_id,
    x.cost_class_id,
    x.cost_cat_id
    FROM
    wr x, cf, efm_contratti, efm_commesse, project,wrbennonfattura
    WHERE x.cf_id=cf.cf_id
    AND x.commessa_id=efm_commesse.commessa_id
    AND x.contratto_id=efm_contratti.contratto_id
    AND x.project_id=project.project_id
    AND efm_commesse.status not in ('Closed')
    and x.wr_id=wrbennonfattura.wr_id
    and project.project_type in ('03','10')
    AND x.cost_class_id is not null
    but I get this error:
    ORA-22818: subquery expressions not allowed here
    How can I rewrite my query to avoid this error?
    Thanks in advance!

    I'm sorry, the solution I gave above may not be correct. Try http://download.oracle.com/docs/cd/B19306_01/server.102/b14200.pdf - section 15-6. And the solution may be:
    ORA-22818: subquery expressions not allowed here
    Cause: An attempt was made to use a subquery expression where these are not supported.
    Action: Rewrite the statement without the subquery expression.

  • "Invalid Metadata Objects" when creating materialized views

    Hi experts,
    I have run into some trouble. I had an analytic workspace that grew too fast (see 11.2.0.2 AW size grows steadily with every cube build so I deleted it and created a new one.
    It seemed to build fine using the tip that David Greenfield gave us in the mentioned forum post, but when I try to enable materialized views (which I had enabled in the previous workspace) I'm gettig the following error:
    Your metadata changes have been saved, with the following errors
    Invalid Metadata Objects:
    Invalid Object "TABLESPACE.LECTURAS": "CREATE MATERIALIZED VIEW "TABLESPACE"."CB$LECTURAS"
    ORGANIZATION CUBE ON TABLESPACE.TABLESPACE_AW(
    FACT "LECTURAS_STORED"("LECTURAS_MEASURE_DIM" 'LECTURA') IS "LECTURA",
    DIMENSION "TIEMPO" IS "TIEMPO" USING "TIEMPO_TIEMPO_HOUR_ID_UNIQUE_KEY" ,
    DIMENSION "GEOGRAFIA" IS "GEOGRAFIA" USING "GEOGRAFIA_GEOGRAFIA_CONTADOR_ID_UNIQUE_KEY" )
    BUILD DEFERRED
    REFRESH ON DEMAND
    FORCE
    USING TRUSTED CONSTRAINTS
    AS
    SELECT
    TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') "TIEMPO",
    T1."COD_METERID" "GEOGRAFIA",
    SUM(T1."VAL_AI_HOR") "LECTURA"
    FROM
    TABLESPACE."LECTURA_HORARIA_FINAL" T1
    GROUP BY
    (TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') , T1."COD_METERID")
    ORA-00942: table or view does not exist
    Running this same script in SQLDeveloper yields the same error at line 17, which is the FROM clause. BUT I can run the SELECT statement by itself and returns the expected result. So the table exists in the correct tablespace.
    I must be missing something big...
    Thanks in advance.
    Joan
    P.S.: In the code above I'm using "TABLESPACE" in substitution for the real username and tablespace name (which is the same) for privacy reasons.

    When you ran the select statement, were you connected as the same user that you used to try to enable the MVs?
    Can you create a standard (non cube) MV with the same select statement? (Connected as the same user you used in AWM.)
    "CREATE MATERIALIZED VIEW "TABLESPACE"."MV_TEST"
      BUILD DEFERRED
      REFRESH ON DEMAND
      FORCE
      USING TRUSTED CONSTRAINTS
    AS
      SELECT
       TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') "TIEMPO",
       T1."COD_METERID" "GEOGRAFIA",
       SUM(T1."VAL_AI_HOR") "LECTURA"
      FROM
       TABLESPACE."LECTURA_HORARIA_FINAL" T1
      GROUP BY
       (TO_CHAR(T1."FEC_LECTURA", 'dd/mm/yyyy hh24:mi:ss') , T1."COD_METERID")
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error While Creating Materialized View

    Hello,
    I am getting error ORA-22818: subquery expressions not allowed here while creating materialized view. I am using Oracle9i Enterprise Edition Release 9.2.0.1.0. Below pasted is my SQL Script.
    Any help is highly appreciable.
    Thanks
    *********SQL************
    select distinct(id),NAME,(select count(GRADE) from employees where
    nationality like '%US%'and id=a.organization_id and grade=a.grade
    group by ID,GRADE) US,(select count(GRADE) from employees where
    nationality not like '%US%' and organization_id=a.organization_id and grade=a.grade
    group by ORGANIZATION_ID,GRADE) NON_US,grade from employees a
    where grade is not null
    group by GRADE,ID,name
    order by to_number(grade) desc

    Hi,
    This is a documented restriction on MVs. You cannot have a scalar express (i.e a select statement) in the select list.
    You can get round this by joining your select count(grade).. expression in as an inline view in your FROM clause. Or you can create a normal view without the scalar expression, create your MV as a select from this view, then re-define your view to contain the query you want.
    Hope that helps,
    Rod West

  • Error while creating Materialized View step 3 of 6 using wizard

    have oracle 9i Rel 1 on Windows 2000 server. Master Site has been setup. Database links are created at Materialized view site. But while creating Materialized View Group using wizard there is following error on step 3 of 6.
    Statement:----------------
    /*OracleOEM*/ SELECT 1 FROM SYS.dba_constraints@masterdbname WHERE OWNER='username' and table_name='tabname' AND constraint_type='P'
    Stack Trace:----------------
    ORA-00942: table or view does not exist.
    ORA-02063: preceding line from masterdbname.
    All parameters for replication are correct.
    Please help me early.
    Thanks

    Hello,
    In the masterdbname, logging as sys user, you must grant select permission on sys.dba_constraints view to mvadmin_dbname user (where dbname is the replicated database name).
    Regards,

  • Error while creating Materialized View step 3 of 6

    I have oracle 9i Rel 1 on Windows 2000 server. Master Site has been setup. Database links are created at Materialized view site. But while creating Materialized View Group there is following error on step 3 of 6.
    Statement:----------------
    /*OracleOEM*/ SELECT 1 FROM SYS.dba_constraints@masterdbname WHERE OWNER='username' and table_name='tabname' AND constraint_type='P'
    Stack Trace:----------------
    ORA-00942: table or view does not exist.
    ORA-02063: preceding line from masterdbname.
    All parameters for replication are correct.
    Please help me early.
    Thanks

    Hello,
    In the masterdbname, logging as sys user, you must grant select permission on sys.dba_constraints view to mvadmin_dbname user (where dbname is the replicated database name).
    Regards,

  • Error in creating materialized view

    Hi all,
    I am trying to create the following materialized view, but throwing me the error message below
    CREATE MATERIALIZED VIEW "MVIW"."XXFA_R051_SHT2_AMV"
    (PARTITION BY LIST (PERIOD_YEAR)
    PARTITION YEAR2006 VALUES LESS ('2006'),
    PARTITION YEAR2007 VALUES LESS ('2007'),
    PARTITION YEAR2007 VALUES LESS ('2008'))
    TABLESPACE "MVIEW"
    BUILD IMMEDIATE
    USING INDEX
    REFRESH FORCE ON DEMAND
    USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS (SELECT * FROM XXFA_R051_SHT2_MV);
    SQL Error: ORA-00907: missing right parenthesis
    00907. 00000 - "missing right parenthesis"
    *Cause:   
    *Action:
    Any pointers would be appreciated
    Thanks
    VR

    What is it your are actually trying to do?
    On one hand you say:
    PARTITION BY LIST (PERIOD_YEAR)
    Then you proceed to use the syntax for range partitioning:
    VALUES LESS ('2006'),
    Look up the correct syntax at http://tahiti.oracle.com or the demos in Morgan's Library at www.psoug.org.

  • ORA-12052 when create materialized view

    I following the sample in Oracle document to create materialized viewCREATE MATERIALIZED VIEW LOG ON sales
       WITH ROWID, SEQUENCE(amount_sold, time_id, prod_id)   INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW LOG ON times
       WITH ROWID, SEQUENCE (time_id, calendar_year)  INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW LOG ON products
       WITH ROWID, SEQUENCE (prod_id,prod_name)  INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW sales_mv
       BUILD IMMEDIATE   REFRESH FAST ON COMMIT
       AS SELECT t.calendar_year, p.prod_id, p.prod_name,
          SUM(s.amount_sold) AS sum_sales
          FROM times t, products p, sales s
          WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
          GROUP BY t.calendar_year, p.prod_id, p.prod_name; This works. BUt I actually does not want do aggregation. Thus I changed the MV creation statement toCREATE MATERIALIZED VIEW sales_mv
       BUILD IMMEDIATE REFRESH FAST ON COMMIT
       AS SELECT t.calendar_year, p.prod_id, p.prod_name,s.amount_sold
          FROM times t, products p, sales s
          WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id;I got errorSQL Error: ORA-12052: cannot fast refresh materialized view GLU.SALES_MV
    *Cause:    Either ROWIDs of certain tables were missing in the definition or
               the inner table of an outer join did not have UNIQUE constraints on
               join columns.
    *Action:   Specify the FORCE or COMPLETE option. If this error is got
               during creation, the materialized view definition may have be
               changed. Refer to the documentation on materialized views.Please help or point me to the relevant document.
    Thanks

    damorgan, Thank you for you reply.
    the inner table of an outer join did not have UNIQUE constraints on join columns.
    I am not sure how much clearer and explanation can be written.If you look at the query, you will find that there is no outer join in the query.
    sales table does not have unique constraints on prod_id and time_id. If this is the cause of the problem, I cannot change the data but is there a work around. That is way I ask for specific doc. In 11g documents, I only find some info on CREATE MV. That is mainly on syntax but not on requirement.

  • Insufficient Privileges when create materialized view as user system

    If I login as system (connect sys/****@DevDB) and try to create a materialized view for another schema (e.g. XDCONTROLDB), I get the insufficient privileges error. If I login as sys as sysdba then I can create successfully.
    I have searched some ariticles in Google and grant create any snapshot, create any table, create any view, global query rewrite, select any table system privileges to system but still get the same error.
    Any other privileges I need to grant to system?
    Cheers
    below is a sample script to create the view which get the error:
    CREATE MATERIALIZED VIEW XDControlDB."XDTest1" PCTFREE 10
    PCTUSED 0 MAXTRANS 255
    STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0)
    TABLESPACE "USERS"
    BUILD IMMEDIATE
    REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
    ENABLE QUERY REWRITE AS
    SELECT * From XDControlDB.RiskInstance;
    Message was edited by:
    user500168
    Message was edited by:
    user500168

    Thanks for your reply. After I grant privileges to system, I login as system and try to create the view as below which I get the insufficient privileges error:
    CREATE MATERIALIZED VIEW XDControlDB."XDTest1" PCTFREE 10
    PCTUSED 0 MAXTRANS 255
    STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0)
    TABLESPACE "USERS"
    BUILD IMMEDIATE
    REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
    ENABLE QUERY REWRITE AS
    SELECT 1 From XDControlDB.RiskInstance;
    As you can see, I try to create the view under a schema called 'XDCONTROLDB'. If I login as sys as sysdba, then it create successfully.
    After I create UserA, and grant the privileges I mentioned in the ealier post, I login as UserA, and run the statement above I get the same privileges error. But if I change the stament to below which will create the view under UserA's schema, then it create successfully:
    CREATE MATERIALIZED VIEW UserA."XDTest1" PCTFREE 10
    PCTUSED 0 MAXTRANS 255
    STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0)
    TABLESPACE "USERS"
    BUILD IMMEDIATE
    REFRESH COMPLETE START WITH sysdate NEXT sysdate + 1/24
    ENABLE QUERY REWRITE AS
    SELECT 1 From XDControlDB.RiskInstance;
    Looking for your suggestions,
    Cheers

  • Error while creating Materialized Views

    I tried creating Materialized views with set operator, and Oracle throws up an error message
    ORA-30370: set operators are not supported in this context
    The script,
    CREATE MATERIALIZED VIEW ORADBA2.MV_GP_AGG_00055_MMR1
    PCTFREE 0 TABLESPACE GPMTSPOC
    STORAGE (INITIAL 128K NEXT 128K MAXEXTENTS UNLIMITED)
    BUILD IMMEDIATE
    REFRESH COMPLETE
    ENABLE QUERY REWRITE
    AS
    SELECT * FROM tb_gp_agg_00055r1_01
    WHERE srce_sys_cd = 15
    UNION ALL
    SELECT * FROM tb_gp_agg_00055r1_02
    WHERE srce_sys_cd = 15
    UNION ALL
    SELECT * FROM tb_gp_agg_00055r1_03
    WHERE srce_sys_cd = 15;
    Will Oracle support UNION clause in Materialized Views?? Any work arounds ?? Thanks.
    null

    SET operators cannot be used in MATERIALIZED VIEWS.
    A workaround is that you create a table AS SELECT using the SET operators and then create the materialized view from that table.
    But then you'll not be able to take advantage of QUERY REWRITE AND AUTOMATIC REFRESH.
    But if you would still like to have the materialized view then this will work!!

  • Error when creating a view in r/3

    Guys,
    This is the first time creating a view in my R/3 sandbox, when I try to save it for the first time, It is asking for the development class, as it is just sand box, I typed "$TMP" and trying to save it as a local object.
    But it give me an error saying "Test objects cannot be created in foreign namespaces". What do I need to do now.
    Please help...Urgent...
    Points are assured...
    Thanks in advance,

    Guys,
    I got it. The name of the view was not named starting with 'Z'. So I renamed it as 'ZREQ_DAT' and it works now.
    Thanks,
    Sirish.

  • Error when refreshing Materialized View...

    Hello
    I included below code in my procedure which will get called from a concurrent program from Oralce Application (11.5.10.2). When I run this refresh command from SQL/TOAD it is working but erroring out (Error: ORA-00900: invalid SQL statement) when the same getting called from a concurrent program. Please suggest me how to refresh a Materialized View through a concurrent program...
    l_chr_text := 'execute dbms_snapshot.refresh (''tk_legacy_acct_stg'',''C'');';
    execute immediate l_chr_text;
    Thanks!!

    l_chr_text := 'execute dbms_snapshot.refresh (''tk_legacy_acct_stg'',''C'');';
    execute immediate l_chr_text;replace above with below
    dbms_snapshot.refresh (''tk_legacy_acct_stg'',''C'');

Maybe you are looking for