Create materialized view as part of refresh group

Hello,
When I create a materialized view in 11g it automatically creates its own refresh group. How can I create the materialized group as part of an existing refresh group? (I know I can drop the individual refresh group and add the mview to the main refresh group but that is a pain).
Thank you,

>
How can I create the materialized group as part of an existing refresh group?
>
You can't - you need to add the MV to the existing refresh group.
See the Add Procedure of the DBMS_REFRESH package
http://docs.oracle.com/cd/B28359_01/server.111/b28327/rarrefreshpac.htm

Similar Messages

  • How to CREATE MATERIALIZED VIEW LOG (MV fast refresh) with some JOINS

    Hi @ all,
    i'm trying to create a MATERIALIZED VIEW LOG for a fast refresh of a MATERIALIZED VIEW.
    It works fine with a simple Request in the MATERIALIZED VIEW:
    CREATE MATERIALIZED VIEW MV_ZOTD43_P
    TABLESPACE GDII
    BUILD IMMEDIATE
    REFRESH FORCE AS
    SELECT * FROM ZOTD43_P;
    COMMIT;
    CREATE MATERIALIZED VIEW LOG ON ZOTD43_P
    TABLESPACE "GDII"
    WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
    call DBMS_MVIEW.REFRESH('MV_ZOTD43_P', 'f');
    But when I use a complex SQL-Request with some JOINS (one of the Table with spatial Data) in the MATERIALIZED VIEW, I get an error:
    CREATE MATERIALIZED VIEW MV_TEST
    TABLESPACE GDII
    BUILD IMMEDIATE
    REFRESH FORCE AS
    SELECT lptd04_p.sst_nr AS sst_nr,
    lptd03_p.aaaa AS aaaa,
    lptd04_geom.geom as geom
    FROM lptd04_p lptd04_p
    JOIN lptd01_p lptd01_p ON lptd01_p.cre_nr = lptd04_p.sst_nr
    JOIN lptd04_geom ON lptd04_geom.sst_nr = lptd04_p.sst_nr
    JOIN lptd03_p lptd03_p ON lptd03_p.lief_nr = lptd04_p.lief_nr;
    COMMIT;
    CREATE MATERIALIZED VIEW LOG ON LPTD04_P
    TABLESPACE "GDII"
    WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
    call DBMS_MVIEW.REFRESH('MV_TEST', 'f');
    Error report:
    SQL Error: ORA-12004: REFRESH FAST kann für Materialized View "GDI"."MV_GDI_SST_STAMM" nicht benutzt werden
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2255
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2461
    ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2430
    ORA-06512: in Zeile 1
    12004. 00000 - "REFRESH FAST cannot be used for materialized view \"%s\".\"%s\""
    *Cause:    The materialized view log does not exist or cannot be used. PCT
    refresh is also not enabled on the materialized view
    *Action:   Use just REFRESH, which will reinstantiate the entire table.
    If a materialized view log exists and the form of the materialized
    view allows the use of a materialized view log or PCT refresh is
    possible after a given set of changes, REFRESH FAST will
    be available starting the next time the materialized view is
    refreshed.
    Am I doing something wrong or is it not possible CREATE MATERIALIZED VIEW LOG when the MATERIALIZED VIEW got some JOINS?
    Regards,
    Greq

    Thanks for the link Alessandro ,
    the error seems something to do with the Column-Type SDO_GEOMETRY, so
    i create a new thread in the Spatial Discussion forum:
    FAST REFRESHing of Oracle Materialized Views containing SDO_GEOMETRY column
    Regards,
    Greq

  • Create materialized view is failing when refresh fast is used

    version 10.2.0.4 on solaris
    This statement is working fine
    CREATE MATERIALIZED VIEW MVIEW1
    TABLESPACE MIS_CURD01
    BUILD IMMEDIATE
    as
    SELECT ACTIVITY_ID "ACTIVITY_ID",
    ASSOC_ID "ASSOC_ID",
    PIT_ROLE_CODE "PIT_ROLE_CODE",
    PIT_BANK_CODE "PIT_BANK_CODE",
    PIT_COST_CENTER "PIT_COST_CENTER",
    RESP_ASSOC_IND "RESP_ASSOC_IND"
    FROM TABLE1@DBLINK;
    The statement with fast refresh is failing with this error message
    ERROR at line 18:
    ORA-12018: following error encountered during code generation for
    "TABLE1"
    ORA-00942: table or view does not exist
    Here is the statement
    CREATE MATERIALIZED VIEW MVIEW1
    TABLESPACE MIS_CURD01
    NOCACHE
    LOGGING
    NOCOMPRESS
    NOPARALLEL
    BUILD IMMEDIATE
    USING INDEX TABLESPACE MIS_CURI01
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    AS
    SELECT ACTIVITY_ID "ACTIVITY_ID",
    ASSOC_ID "ASSOC_ID",
    PIT_ROLE_CODE "PIT_ROLE_CODE",
    PIT_BANK_CODE "PIT_BANK_CODE",
    PIT_COST_CENTER "PIT_COST_CENTER",
    RESP_ASSOC_IND "RESP_ASSOC_IND"
    FROM TABLE1@DBLINK;
    Any idea what's going wrong here. Thanks for your help in advance.
    Edited by: user11319873 on Jun 30, 2010 4:17 PM

    Refresh FAST requires that
    a. An MV Log (Snapshot Log) be created on the source table
    b. The user doing the refresh (i.e. the account that the DBLink uses) has SELECT privilege on the MV Log.
    Hemant K Chitale

  • Problem creating materialized view

    OK, I'm totally new in using materialized views.
    I'm trying to create one and to make it refreshed on commit
    CREATE MATERIALIZED VIEW VK_CLIENT  build immediate refresh fast on commit AS
      select c1.code,
    c1.fiche fiche_1,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', 'M. et Mme', c1.lnte ), c1.lnte ) lnte_1,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', 
    decode( c1.lnte, 'M.', c1.libe, c7.libe ), c1.libe ), c1.libe ) libe_1,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', 
    decode( c1.lnte, 'M.', substr( c1.libe, 1, c1.lgnom ), substr( c7.libe, 1, c7.lgnom ) ), substr( c1.libe, 1, c1.lgnom ) ), substr( c1.libe, 1, c1.lgnom ) ) nom_1,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', 
    decode( c1.lnte, 'M.', initcap( substr( c1.libe, c1.lgnom + 2 ) ), initcap( substr( c7.libe, c7.lgnom + 2 ) ) ), initcap( substr( c1.libe, c1.lgnom + 2 ) ) ), initcap( substr( c1.libe, c1.lgnom + 2 ) ) ) prenom_1,
    decode( c1.sfam, '04', decode( c7.sfam, '04', decode( c1.lnte, 'Mlle', 'Mme', c1.lnte ), c1.lnte ), c1.lnte ) lnte_1_bis,
    c1.libe libe_1_bis,
    substr( c1.libe, 1, c1.lgnom ) nom_1_bis,
    initcap( substr( c1.libe, c1.lgnom + 2 ) ) prenom_1_bis,
    c1.sfam sfam_1,
    c1.dnai dnai_1,
    decode( to_char( c1.dnai, 'dd' ), '01', '1er', 
    decode( substr( to_char( c1.dnai, 'dd' ), 1, 1 ), 0, substr( to_char( c1.dnai, 'dd' ), 2 ), to_char( c1.dnai, 'dd' ) ) ) || ' ' || 
    rtrim( to_char( c1.dnai, 'month', 'nls_date_language = french' ) ) || to_char( c1.dnai, ' yyyy' ) dnai_fr_1,
    c1.horsfoyer horsfoyer_1,
    decode( c1.lnte, 'Mlle', 'f', 'Mme', 'f', 'M.', 'm' ) accord_1,
    c7.fiche fiche_7,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', null, c7.lnte ), c7.lnte ) lnte_7,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', null, c7.libe ), c7.libe ) libe_7,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', null, substr( c7.libe, 1, c7.lgnom ) ), substr( c7.libe, 1, c7.lgnom ) ) nom_7,
    decode( c1.sfam, '04', 
    decode( c7.sfam, '04', null, initcap( substr( c7.libe, c7.lgnom + 2 ) ) ), initcap( substr( c7.libe, c7.lgnom + 2 ) ) ) prenom_7,
    decode( c7.sfam, '04', decode( c1.sfam, '04', decode( c7.lnte, 'Mlle', 'Mme', c7.lnte ), c7.lnte ), c7.lnte ) lnte_7_bis,
    c7.libe libe_7_bis,
    substr( c7.libe, 1, c7.lgnom ) nom_7_bis,
    initcap( substr( c7.libe, c7.lgnom + 2 ) ) prenom_7_bis,
    c7.sfam sfam_7,
    c7.dnai dnai_7,
    decode( to_char( c7.dnai, 'dd' ), '01', '1er', 
    decode( substr( to_char( c7.dnai, 'dd' ), 1, 1 ), 0, substr( to_char( c7.dnai, 'dd' ), 2 ), to_char( c7.dnai, 'dd' ) ) ) || ' ' || 
    rtrim( to_char( c7.dnai, 'month', 'nls_date_language = french' ) ) || to_char( c7.dnai, ' yyyy' ) dnai_fr_7,
    decode( c7.lnte, 'Mlle', 'f', 'Mme', 'f', 'M.', 'm' ) accord_7,
    initcap( decode( instr( lower( c1.adr1 ), 'log' ), '1', c1.adr2, decode( instr( lower( c1.adr1 ), 'bât' ), '1', c1.adr2, c1.adr1 ) ) ) adr1,
    initcap( decode( decode( instr( lower( c1.adr1 ), 'log' ), '1', c1.adr2, decode( instr( lower( c1.adr1 ), 'bât' ), '1', c1.adr2, c1.adr1 ) ), c1.adr2, null, 
    decode( instr( lower( c1.adr2 ), 'log' ), '1', c1.adr3, decode( instr( lower( c1.adr2 ), 'bât' ), '1', c1.adr3, c1.adr2 ) ) ) ) adr2,
    initcap( decode( instr( lower( c1.adr3 ), 'log' ), '1', null, decode( instr( lower( c1.adr3 ), 'bât' ), '1', null, c1.adr3 ) ) ) adr3,
    c1.ptt,
    c1.lcom,
    decode( c7.fiche, null, decode( c1.lnte, 'Mme', 'Madame', 'Mlle', 'Mademoiselle', 'M.', 'Monsieur', 'Monsieur' ),
    decode( nvl( c1.sfam, '07' ), '04', 
    decode( nvl( c7.sfam, '07' ), '04', 'Madame, Monsieur', 
    decode( c1.lnte, 
    'Mme', decode( c7.lnte, 'Mme', 'Mesdames', 'Mlle', 'Madame, Mademoiselle', 'M.', 'Madame, Monsieur', 'Madame, Monsieur' ), 
    'Mlle', decode( c7.lnte, 'Mme', 'Madame, Mademoiselle', 'Mlle', 'Mesdemoiselles', 'M.', 'Mademoiselle, Monsieur', 'Mademoiselle, Monsieur' ),
    'M.', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
    '. ', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
    decode( c1.lnte,
    'Mme', decode( c7.lnte, 'Mme', 'Mesdames', 'Mlle', 'Madame, Mademoiselle', 'M.', 'Madame, Monsieur', 'Madame, Monsieur' ),
    'Mlle', decode( c7.lnte, 'Mme', 'Madame, Mademoiselle', 'Mlle', 'Mesdemoiselles', 'M.', 'Mademoiselle, Monsieur', 'Mademoiselle, Monsieur' ),
    'M.', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
    '. ', decode( c7.lnte, 'Mme', 'Madame, Monsieur', 'Mlle', 'Mademoiselle, Monsieur', 'M.', 'Mesieurs', 'Mesieurs' ),
    '-' ) ) ) lnte_long,
    decode( c1.cfam, null, c7.cfam, c1.cfam ) cfam,
    decode( c1.cfam, null, c7.allo, c1.allo ) allo,
    decode( c1.sexe, 'm', decode( c7.sexe, null, 'ms', 'm', 'mp', 'f', 'mp' ), 'f', decode( c7.sexe, null, 'fs', 'm', 'mp', 'f', 'fp' ), '-' ) accord,
    c9.fiche fiche_9,
    c9.lnte lnte_9,
    c9.libe libe_9,
    substr( c9.libe, 1, c9.lgnom ) nom_9,
    initcap( substr( c9.libe, c9.lgnom + 2 ) ) prenom_9,
    initcap( decode( instr( lower( c9.adr1 ), 'log' ), '1', c9.adr2, decode( instr( lower( c9.adr1 ), 'bât' ), '1', c9.adr2, c9.adr1 ) ) ) adr1_9,
    initcap( decode( decode( instr( lower( c9.adr1 ), 'log' ), '1', c9.adr2, decode( instr( lower( c9.adr1 ), 'bât' ), '1', c9.adr2, c9.adr1 ) ), c9.adr2, null, 
    decode( instr( lower( c9.adr2 ), 'log' ), '1', c9.adr3, decode( instr( lower( c9.adr2 ), 'bât' ), '1', c9.adr3, c9.adr2 ) ) ) ) adr2_9,
    initcap( decode( instr( lower( c9.adr3 ), 'log' ), '1', null, decode( instr( lower( c9.adr3 ), 'bât' ), '1', null, c9.adr3 ) ) ) adr3_9,
    c9.ptt ptt_9,
    c9.lcom lcom_9,
    decode( c9.lnte, 'Mlle' , 'Mademoiselle', 'Mme', 'Madame', 'M.', 'Monsieur', 'M. et Mme', 'Madame, Monsieur', null ) lnte_long_9,
    decode( c9.sexe, 'm', 'ms', 'f', 'fs', null, null, '-' ) accord_9,
    no.nbocc
    from client c1,
    client c7, 
    client c9,
    select z.code code,
    count(*) nbocc
    from client z
    where to_char( sysdate, 'yyyymmdd' ) between to_char( z.cdeb, 'yyyymmdd' ) and to_char( nvl( z.cfin, sysdate ), 'yyyymmdd' )
    group by z.code
    ) no
    where c1.code = c7.code (+)
    and c1.role = '1'
    and c7.role (+) ='7'
    and nvl( c7.horsfoyer (+), 0 ) = '0'
    and to_char( nvl( c7.cfin (+), sysdate ), 'yyyymmdd' ) >= to_char( sysdate, 'yyyymmdd' )
    and c1.code = c9.code (+)
    and c9.role (+) = '9'
    and to_char( nvl( c9.cfin (+), sysdate ), 'yyyymmdd' ) >= to_char( sysdate, 'yyyymmdd' )
    and c9.lnte (+) not in ( '. ', 'Assoc.', 'Ste' )
    and c9.lcom (+) is not null
    and c1.code = no.code (+);when doing so, I'm getting a ORA-12054:
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
    12054. 00000 - "cannot set the ON COMMIT refresh attribute for the materialized view"
    *Cause:    The materialized view did not satisfy conditions for refresh at
    commit time.
    *Action:   Specify only valid options.
    When I create the materialized view with just CREATE MATERIALIZED VIEW "H6801_GL_00"."VK_CLIENT" AS
    it works but the refresh is only "ON DEMAND"...
    Can't find how and why it won't work...
    Edited by: MacFizz on Dec 17, 2009 3:22 PM

    You could try the DBMS_MVIEW.TUNE_MVIEW and check if you can modify you materialized view or "refactor" it in a smaller, fast refreshable part that you could combine later to the sysdate/rownum part of it.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10821/advisor.htm
    Explanation on restrictions of fast refresh:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10706/repmview.htm
    Below there's an example of a fast refreshable mview, on creating the materialized view log and so on:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10592/statements_6002.htm#i2080820

  • 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.

  • Error creating materialized view log using DBlink

    Hi guys,
    I have 2 databases in diferent machines . (machine A and B)
    Machine A is my production database and I have a database link in machine B accessing Machine A
    CREATE MATERIALIZED VIEW vm_test
    BUILD IMMEDIATE
    REFRESH FAST ON commit as
    select * from test@A
    -- no problem in this first operation the materialized view was created sucessfully
    Now I need to create the LOG
    SQL> CREATE MATERIALIZED VIEW LOG ON test
    2 PCTFREE 5
    3 TABLESPACE prodemge_2006
    4 STORAGE (INITIAL 10K NEXT 10K);
    CREATE MATERIALIZED VIEW LOG ON test
    ERROR at line 1:
    ORA-02050: transaction 5.21.8771 rolled back, some remote DBs may be in-doubt
    ORA-02068: following severe error from A
    ORA-03113: end-of-file on communication channel
    What could be causing this error ?
    Thank you,
    Felipe

    ORA-02050 transaction string rolled back, some remote DBs may be in-doubt
    Cause: Network or remote failure during a two-phase commit.
    Action: Notify operations; remote databases will automatically re-sync when the failure is repaired.
    ORA-02068 following severe error from stringstring
    Cause: A severe error (disconnect, fatal Oracle error) was received from the indicated database link. See following error text.
    Action: Contact the remote system administrator.
    M.S.Taj

  • 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.

  • Create Materialized View  based on another database table using db link?

    SQL> SELECT sysdate
    2 FROM dual@CBRLINK ;
    SYSDATE
    21-NOV-12
    SQL> CREATE MATERIALIZED VIEW USERCBR.V_T24_COUNTRY1
    2 REFRESH COMPLETE
    3 START WITH SYSDATE NEXT SYSDATE + (5/24)
    4 AS
    5 SELECT sysdate
    6 FROM dual@CBRLINK ;
    CREATE MATERIALIZED VIEW USERCBR.V_T24_COUNTRY1
    ERROR at line 1:
    ORA-04052: error occurred when looking up remote object SYS.DUAL@CBRLINK
    ORA-00600: internal error code, arguments: [ORA-00600: internal error code,
    arguments: [qksfroFXTStatsLoc() - unknown KQFOPT type!], [0], [], [], [], [],
    ORA-02063: preceding line from CBRLINK

    It works for me:orcl>
    orcl> CREATE MATERIALIZED VIEW scott.V_T24_COUNTRY1
      2  REFRESH COMPLETE
      3  START WITH SYSDATE NEXT SYSDATE + (5/24)
      4  AS
      5  SELECT sysdate
      6  FROM dual@l1 ;
    Materialized view created.
    orcl> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for 32-bit Windows: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    orcl>so there is no problem with the code. HTH.

  • Create materialized view get ora-00998 error cause by subquery

    hi all,
    my create statement as follow,
    create materialized view MV_DM_DIM_DEALER01
    Build deferred
    Refresh complete
    ON DEMAND
    Enable query rewrite
    as
    select a.dealer_no,a.sk_period from DM_DIM_DEALER a
    where A.SK_PERIOD=201210 and a.dealer_no in (select dealer_No from dm00_fav_dealer)
    ORA-00998: must name this expression with a column alias
    so what's the problem?
    thx all

    >
    my create statement as follow,
    create materialized view MV_DM_DIM_DEALER01
    Build deferred
    Refresh complete
    ON DEMAND
    Enable query rewrite
    as
    select a.dealer_no,a.sk_period from DM_DIM_DEALER a
    where A.SK_PERIOD=201210 and a.dealer_no in (select dealer_No from dm00_fav_dealer)
    ORA-00998: must name this expression with a column alias
    so what's the problem?
    >
    Well since the error is 'ORA-00998: must name this expression with a column alias' you might try naming your expressions with aliases
    select a.dealer_no dealer_no,a.sk_period sk_period from DM_DIM_DEALER a

  • Create materialized view in SE referring table in EE

    Hi DBAs,
    I am trying to create a Materialized view on Oracle 10g Standard Edition which is installed on Linux Debian Lenny.
    The master table is on Oracle 10g Enterprise Edition installed on Red Hat Linux 4.1.2.
    When I run,
    create materialized view t1 build immediate refresh fast as (select * from aksharaemsmigrated.t1@db102)
    i get,
    ORA-12028: materialized view type is not supported by master site
    When I run,
    create materialized view t1 build immediate refresh fast on commit as (select * from aksharaemsmigrated.t1@db102);
    I get,
    ORA-01031: insufficient privileges
    When I run,
    select * from aksharaemsmigrated.t1@db102
    I get,
    the rows from aksharaemsmigrated.t1@db102
    NOTE: 'db102' is remote DB on 10g EE for which I created db link.
    I am able to create Mview for local table.
    Is this not supported? I mean creating Mview on Oracle SE referring base table from Oracle EE.
    I have to give solution soon. Can you please throw some light.
    Regards,
    Vijay

    Don't put select statement inside parantheses.
    Test these
    create table x1 as select * from aksharaemsmigrated.t1@db102;
    create materialized view t1 build immediate refresh fast as select * from aksharaemsmigrated.t1@db102 ;Note that you cannot create an MV that is REFRESH ON COMMIT when across Databases.
    See my explanation at http://hemantoracledba.blogspot.com/2008/06/mvs-with-refresh-on-commit-cannot-be.html
    Hemant K Chitale

  • Create Materialized View with GROUP BY

    I have a table
    treecluster NUMBER(3)
    treenumber NUMBER(3)
    treedate DATE
    nestnumber NUMBER(3)
    eggs NUMBER(3)
    nestlings NUMBER(3)
    fledglings NUMBER(3)
    nestfate VARCHAR2(10)
    nestfailurecode NUMBER(2)
    I want to group the data by treecluster, treenumber, year, and nest number and get a max eggs, nestlings, fledglings. I am doing this with the following:
    SELECT treecluster, treenumber, to_char(nestchecksdate, 'YYYY'), nestnumber,
    max(eggs), max(nestlings), max(fledglings)
    FROM nestchecks
    GROUP BY treecluster, treenumber, to_char(nestchecksdate, 'YYYY'), nestnumber;
    This works fine.
    The last record for a year has a nestfate and nestfailurecode value.
    I need to group all information and then also get the nestfate and nestfailurecode for the year. How do I go about getting this information?
    I am really trying to create a summary materialized view based on a data table so the select I am trying to craft would be a part of a create materialized view as SELECT...
    so I want to be able to group the info and add in the nestfate and failurecode in one step.
    Thanks!

    try this:
    SQL> select * from table_tree;
    TREECLUSTER TREENUMBER NESTCHECK NESTNUMBER       EGGS  NESTLINGS FLEDGLINGS NESTFATE   NESTFAILURECODE
              4        167 17-MAY-00          2          0          0
              4        167 24-MAY-00          2          3          0
              4        167 30-MAY-00          2          3          0
              4        167 12-JUN-00          2          0          1            FAILURE                  2
    select a.treecluster, a.treenumber, to_char(a.nestyear,'YYYY') nestyear,
           a.nestnumber, a.eggs, a.nestlings, a.fledglings, a.nestfate, a.nestfailurecode
    from   (select max(treecluster) treecluster, max(treenumber) treenumber,
                   max(nestchecksdate) nestyear,
                   max(nestnumber) nestnumber, max(eggs) eggs, max(nestlings) nestlings,
                   nvl(max(FLEDGLINGS),0) FLEDGLINGS, max(NESTFATE) NESTFATE,
                   max(nestfailurecode) nestfailurecode
            from table_tree) a
    TREECLUSTER TREENUMBER NEST NESTNUMBER       EGGS  NESTLINGS FLEDGLINGS NESTFATE   NESTFAILURECODE
              4        167 2000          2          3          1          0 FAILURE                  2hope this helps

  • Is it possible to create materialized view log file for force refresh

    Is it possible to create materialized view log file for force refresh with join condition.
    Say for example:
    CREATE MATERIALIZED VIEW VU1
    REFRESH FORCE
    ON DEMAND
    AS
    SELECT e.employee_id, d.department_id from emp e and departments d
    where e.department_id = d.department_id;
    how can we create log file using 2 tables?
    Also am copying M.View result to new table. Is it possible to have the same values into the new table once the m.view get refreshed?

    You cannot create a record as a materialized view within the Application Designer.
    But there is workaround.
    Create the record as a table within the Application Designer. Don't build it.
    Inside your database, create the materialized with same name and columns as the record created previously.
    After that, you'll be able to work on that record as for all other within the Peoplesoft tools.
    But keep in mind do never build that object, that'll drop your materialized view and create a table instead.
    Same problem exists for partitioned tables, for function based-indexes and some other objects database vendor dependant. Same workaround is used.
    Nicolas.

  • Creating Materialized View in Toad

    As with every new endeavor - come new questions.
    I am trying to create a materialized view via toad (first time doing this). Now - toad is great, since it provides a kind-of wizard interface. Hence, one doesn't have to completely code in the create statement, with all of the options, etc.
    Instead, in toad, one can (via the schema browser), go into the Materialized Views tab and click on create new. This opens a window with 6 tabs: Basic Info, Refresh Info, Physical Attributes, Query, Partitions & Subpartition Template.
    In the Basic Info, one can put a check mark next to some of the following options:
    -Build Deffered
    -Parallel
    -Cache
    -Logging
    -Using index
    -Allow updates
    etc.
    I have read that build deferred refers to whether or not you would like the view to be created automatically or to be deferred.
    Anyways, I tried to find Toad documentation to explain each of the options in-detail. No success. Hence, am researching each part piece by piece.
    But - here is my question:
    In the Query tab, we are asked to specify a query. I am assuming that the query does not have to be a full query, beginning with CREATE MATERIALIZED VIEW mv_table1 REFRESH FAST etc...
    Since in this 'wizard', we are providing the MV name at the top of the dialog box, we are checking the 'options' in the other tabs, etc.
    And so, I assumed that the query should merely be a select query in the window mentioned above.
    So I entered the following:
    select * from table1@remote_db;
    When I go to verify the syntax, I get the error message: ORA_00911: invalid character. It seems to be pointing to my db_link (remote_db). I have been using this link throughout many places, w/o any problems.
    Has anyone created a MV in toad before? Any links to good toad documentation would be helpful as well.
    Thanks.

    (This is fun... ;))
    For anyone endeavoring this in the future, below I have attached the prerequisites required in order to create a materialized view (can also be found @ http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_6002.htm):
    Prerequisites
    The privileges required to create a materialized view should be granted directly rather than through a role.
    To create a materialized view in your own schema:
    You must have been granted the CREATE MATERIALIZED VIEW system privilege and either the CREATE TABLE or CREATE ANY TABLE system privilege.
    You must also have access to any master tables of the materialized view that you do not own, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
    To create a materialized view in another user's schema:
    You must have the CREATE ANY MATERIALIZED VIEW system privilege.
    The owner of the materialized view must have the CREATE TABLE system privilege. The owner must also have access to any master tables of the materialized view that the schema owner does not own (for example, if the master tables are on a remote database) and to any materialized view logs defined on those master tables, either through a SELECT object privilege on each of the tables or through the SELECT ANY TABLE system privilege.
    To create a refresh-on-commit materialized view (ON COMMIT REFRESH clause), in addition to the preceding privileges, you must have the ON COMMIT REFRESH object privilege on any master tables that you do not own or you must have the ON COMMIT REFRESH system privilege.
    To create the materialized view with query rewrite enabled, in addition to the preceding privileges:
    If the schema owner does not own the master tables, then the schema owner must have the GLOBAL QUERY REWRITE privilege or the QUERY REWRITE object privilege on each table outside the schema.
    If you are defining the materialized view on a prebuilt container (ON PREBUILT TABLE clause), then you must have the SELECT privilege WITH GRANT OPTION on the container table.
    The user whose schema contains the materialized view must have sufficient quota in the target tablespace to store the master table and index of the materialized view or must have the UNLIMITED TABLESPACE system privilege.
    When you create a materialized view, Oracle Database creates one internal table and at least one index, and may create one view, all in the schema of the materialized view. Oracle Database uses these objects to maintain the materialized view data. You must have the privileges necessary to create these objects.

  • 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

  • Error Creating Materialized View With a Job

    Oracle 9ir2
    I've created a job like this in a java class:
    ...Java Code ...
    cs = conn.prepareCall ("DECLARE v_job NUMBER; BEGIN DBMS_JOB.SUBMIT(v_job,'begin CTH_REGENERA_VM; end;', TRUNC(SYSDATE+1) + (3/24)); END;");
    ...Java Code ...
    The Procedure called in the Job:
    CREATE OR REPLACE PROCEDURE CTH_REGENERA_VM
         AUTHID CURRENT_USER IS
         existe NUMBER(1);
         cur BINARY_INTEGER := DBMS_SQL.OPEN_CURSOR;
         fdbk BINARY_INTEGER;
    BEGIN
         SELECT count(*) INTO existe FROM user_mviews WHERE mview_name = 'CTH_PRESENTA_A_VM';
         IF existe > 0 THEN
              DBMS_SQL.PARSE(cur, 'DROP MATERIALIZED VIEW CTH_PRESENTA_A_VM', DBMS_SQL.NATIVE);
         fdbk := DBMS_SQL.EXECUTE(cur);
              INSERT INTO CTH_HISTORIAL VALUES('ELIMINADA VM CTH_PRESENTA_A_VM', SYSDATE);
              COMMIT;
         END IF;
         DBMS_SQL.PARSE(cur, 'CREATE MATERIALIZED VIEW CTH_PRESENTA_A_VM
         TABLESPACE DAT1_CTH
         STORAGE(INITIAL 16M NEXT 8M MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0)
                   XMLTYPE XML STORE AS CLOB (           TABLESPACE DAT1_CTH
                   STORAGE(INITIAL 16M NEXT 8M MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0))
         AS select FICHA, XML,
         extractvalue(xml, ''/FICHE/Encab_de_nombre_geogr�fico_a'') as MUNICIPIO,
         extractvalue(xml, ''/FICHE/Encab_de_nombre_geogr�fico_c'') as CALIFICACION,
         extractvalue(xml, ''/FICHE/Encab_de_nombre_geogr�fico_b'') as PROVINCIA,
         extractvalue(xml, ''/FICHE/Encab_tem�tico_de_materia_a[1]'') as MATERIA,
         extractvalue(xml, ''/FICHE/Fecha_cronol�gica_b[1]'') as FECHA,
         extractvalue(xml, ''/FICHE/Datos_matem�ticos_a[1]'') as ESCALA
         from cth_xmltable', DBMS_SQL.NATIVE);
         INSERT INTO CTH_HISTORIAL VALUES('ASIGNO EL PARSE DE MATERIALIZED', SYSDATE);
         fdbk := DBMS_SQL.EXECUTE(cur);
         INSERT INTO CTH_HISTORIAL VALUES('EJECUTO EL PARSE DE MATERIALIZED', SYSDATE);
         INSERT INTO CTH_HISTORIAL VALUES('CREADA VM CTH_PRESENTA_A_VM', SYSDATE);
         DBMS_SQL.PARSE(cur, 'CREATE INDEX CTH_INDEX1
         ON CTH_PRESENTA_A_VM(XML)
         INDEXTYPE IS CTXSYS.CONTEXT
         PARAMETERS (''storage cth section group ctxsys.auto_section_group'')', DBMS_SQL.NATIVE);
         fdbk := DBMS_SQL.EXECUTE(cur);
         INSERT INTO CTH_HISTORIAL VALUES('CREADO INDICE ORACLE TEXT CTH_INDEX1', SYSDATE);
         DBMS_SQL.PARSE(cur, 'CREATE INDEX CTH_IDX_MUNICIPIO3
              ON CTH_PRESENTA_A_VM(UPPER(MUNICIPIO))
              TABLESPACE IDX1_CTH
              STORAGE (INITIAL 1M NEXT 512K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0)', DBMS_SQL.NATIVE);
         fdbk := DBMS_SQL.EXECUTE(cur);
         INSERT INTO CTH_HISTORIAL VALUES('CREADO INDICE CTH_IDX_MUNICIPIO2', SYSDATE);
         DBMS_SQL.PARSE(cur, 'CREATE INDEX CTH_IDX_FICHA2
         ON CTH_PRESENTA_A_VM
         (FICHA)
         TABLESPACE IDX1_CTH
         STORAGE(INITIAL 1M NEXT 512K MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0)', DBMS_SQL.NATIVE);
         fdbk := DBMS_SQL.EXECUTE(cur);
         INSERT INTO CTH_HISTORIAL VALUES('CREADO INDICE CTH_IDX_FICHA2', SYSDATE);
         DBMS_SQL.CLOSE_CURSOR(cur);
    COMMIT;
    END;
    I got always an error in the created materialized view. If I call the procedure with SQL Plus, it run ok. The user
    has CTXAPP, DBA roles, so I supouse it is not a privileges problem. I also tried to create a simple materialized view or a table, and always got an error ora-12011
    Thanks in advance.

    If I call the procedure with SQL Plus, it run ok. Are you using the same user to run it in SQL*Plus as runs it from Java.
    The normal reason for procedures to fail like this is privileges. Particularly, we cannot run procedures using privileges we have been granted through roles.
    The user has CTXAPP, DBA roles, so I supouse it is not a privileges problem. Try granting the system privilege CREATE MATERIALIZED VIEW to the user and see what happens.
    I drop the materialized and create again, cause it's the fastest way I've found. With a DBMS_MVIEW.REFRESH is too slow.I find that surprising as drop & create has to do all the work that a refresh has to do plus some more - maybe it's something to do with XML. Did you try adding a snapshot log and going for FAST? I don't know whwther the XML procesing would render the view complex - have you explained it?
    Cheers, APC

Maybe you are looking for

  • Multiple jobs writing to a single file

    Hi, My program requires me to create 20 jobs. Each job needs to write into a single file on the application server. I have tried using open dataset, transfer and close dataset approach but it doesn't work. I open the data set before submitting the re

  • Jbutton, listener and so

    hi! When I press my Jbutton, it steps to it's actionlistener, this is ok. :) But in the first part of the AListener's source I want to put a new JPanel into my window(frame etc), containing 'please wait, work is in progress' or so. And after this cod

  • Multiple M91p's in business environment fail to boot

    Since the beginning of the year, the small business I help out has had four thinkcentre m91p 7052a7u's fail in the same manner. The machines power up, but there is no boot activity. 2 of the computers have come back to life after cleaning dust build

  • Error in importing an idoc

    hi friends, i am new to xi.when importing an idoc say from ecc5 to xi for a file to idoc scenario,I am getting this message-'System ECC is running on the specified application server. However, source system sapecc50 is specified in software component

  • Help! iPhone 4s in Recovery Mode after new IOS 7.1.1 update.

    I went to update my iphone 4s earlier to IOS 7.1.1 and now it's in recovery mode. My issue with that is I keep trying to download the update on my computer so it can do the recovery and every time it gets to fully download (which bc I have a ****** i