DBMS_MVIEW package

Is the DBMS_MVIEW package available by default in some directory in the Oracle 9i Release 2 or it must be downloaded?

Razvan,
DBMS_MVIEW is only a public synonym on top of DBMS_SNAPSHOT. The synonym is created as part of script dbmssnap.sql in <db home>/rdbms/admin.
Hope this helps,
Mark.

Similar Messages

  • Refresh List view in Workflow

    Hi all,
    I am trying to create a customized list view using custom.js file. List is being created successfully, when i do a second online request in the same session on the same list, the list is loosing its css and is coming as a hyperlink. this has got something to do with refreshing the list view in custom.js. if anybody has tried this, can u please help me as so where and how do i refresh a list view in custom.js file.
    Regards,
    Kartik

    Hello, Eric
    Try to import dbms_mview package into OWB repository and use them directly.
    The second, easy way - just wrap dbms_mview.refresh into private transformation and use it within your process. I use it in my projects - it works ok.

  • Refresh Fast option in Materialize view

    Dear All,
    We have oracle 10g On windows.
    We have database A having SCOTT schema and tables Emp and Dept.
    I have another database B having TEST schema and this schema does not have any objects (Moto is to create mview on this database).
    We have created DB LINK between TEST schema to SCOTT schema and planning to create materialize view in TEST schema.
    Now I am confuse....
    1) I am creating mview in TEST schema and i want to refresh mview increamentally. I search on internet and found only if you want to use FAST REFRESH then you must have to create log table for the base table.
    --Query is
    1)  I am creating mview in TEST schema and my base tables are in SCOTT schema on different database. Where should i create log table(on SCOTT SCHEMA or TEST schema).
    2) Does this log tables will occupy more space or log table will truncate after refresh of mview.
    3) For using incremental refresh i need to use +REFRESH FORCE+ option or anything else.
    4) If log table will not truncate then it will occupy more space so is there anything that we can come up out of this situation.Thanks..

    1) You should create log in Scott Schema
    2)
    Managing Materialized View Log Space
    Oracle automatically tracks which rows in a materialized view log have been used during the refreshes of materialized views, and purges these rows from the log so that the log does not grow endlessly. Because multiple simple materialized views can use the same materialized view log, rows already used to refresh one materialized view might still be needed to refresh another materialized view. Oracle does not delete rows from the log until all materialized views have used them.
    For example, suppose two materialized views were created against the customers table in a master site. Oracle refreshes the customers materialized view at the spdb1 database. However, the server that manages the master table and associated materialized view log does not purge the materialized view log rows used during the refresh of this materialized view until the customers materialized view at the spdb2 database also refreshes using these rows.
    Because Oracle must wait for all dependent materialized views to refresh before purging rows from a materialized view log, unwanted situations can occur that cause a materialized view log to grow indefinitely when multiple materialized views are based on the same master table or master materialized view.
    For example, such situations can occur when more than one materialized view is based on a master table or master materialized view and one of the following conditions is true:
    One materialized view is not configured for automatic refreshes and has not been manually refreshed for a long time.
    One materialized view has an infrequent refresh interval, such as every year (365 days).
    A network failure has prevented an automatic refresh of one or more of the materialized views based on the master table or master materialized view.
    A network or site failure has prevented a master table or master materialized view from becoming aware that a materialized view has been dropped.
    Note:
    If you purge or TRUNCATE a materialized view log before a materialized view has refreshed the changes that were deleted, then the materialized view must perform a complete refresh.
    Purging Rows from a Materialized View Log
    Always try to keep a materialized view log as small as possible to minimize the database space that it uses. To remove rows from a materialized view log and make space for newer log records, you can perform one of the following actions:
    Refresh the materialized views associated with the log so that Oracle can purge rows from the materialized view log.
    Manually purge records in the log by deleting rows required only by the nth least recently refreshed materialized views.
    To manually purge rows from a materialized view log, execute the PURGE_LOG procedure of the DBMS_MVIEW package at the database that contains the log. For example, to purge entries from the materialized view log of the customers table that are necessary only for the least recently refreshed materialized view, execute the following procedure:
    3) REFRESH FAST
    4) See step 2

  • Fast Refresh on Materialized View With Join

    Hi All,
    i have created following Materialized View Logs and MV
    on EMP and DEPT
    CREATE MATERIALIZED VIEW LOG ON DEPT
    WITH PRIMARY KEY,SEQUENCE
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW LOG ON EMP
    WITH PRIMARY KEY,SEQUENCE
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW EMP_MVW
    TABLESPACE OSMIS_REPORT_DATA
    REFRESH FAST ON COMMIT
    AS
    SELECT A.EMPNO,A.ENAME,A.DEPTNO,A.JOB,A.MGR,A.HIREDATE,A.SAL,A.COMM,B.DNAME,B.LOC
    FROM EMP A,DEPT B
    WHERE A.DEPTNO=B.DEPTNO
    The Create MV Stmnt raised following error.
    ERROR at line 6:
    ORA-12052: cannot fast refresh materialized view SCOTT.EMP_MVW
    I have tried the same with ROWID also,but same error
    while creating MV.
    Pls anyone give idea to Fast Refersh on MV with Joins
    Thnks
    Raj.G.
    mail : [email protected]

    Actually you can get Oracle to tell you why the view does not have the capabilities you want using the DBMS_MVIEW package. For example you could have done something like this...
    Personal Oracle Database 10g Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE MATERIALIZED VIEW LOG ON dept
      2    WITH PRIMARY KEY, SEQUENCE
      3      INCLUDING NEW VALUES;
    Materialized view log created.
    SQL> CREATE MATERIALIZED VIEW LOG ON emp
      2    WITH PRIMARY KEY,SEQUENCE
      3      INCLUDING NEW VALUES;
    Materialized view log created.
    SQL> CREATE MATERIALIZED VIEW emp_mvw
      2    REFRESH FAST ON COMMIT
      3  AS
      4  SELECT a.empno, a.ename, a.deptno,
      5         a.job, a.mgr, a.hiredate,
      6         a.sal, a.comm, b.dname, b.loc
      7  FROM   emp a,dept b
      8  WHERE  a.deptno = b.deptno;
    FROM   emp a,dept b
    ERROR at line 7:
    ORA-12052: cannot fast refresh materialized view SCOTT.EMP_MVW
    SQL> CREATE MATERIALIZED VIEW emp_mvw
      2    REFRESH ON COMMIT -- remove the FAST to allow view to compile
      3  AS
      4  SELECT a.empno, a.ename, a.deptno,
      5         a.job, a.mgr, a.hiredate,
      6         a.sal, a.comm, b.dname, b.loc
      7  FROM   emp a,dept b
      8  WHERE  a.deptno = b.deptno;
    Materialized view created.
    SQL> @\oracle\product\10.1.0\Db_1\RDBMS\ADMIN\utlxmv.sql -- create mv_capabilities_table
    Table created.
    SQL> EXEC DBMS_MVIEW.EXPLAIN_MVIEW ('EMP_MVW');
    PL/SQL procedure successfully completed.
    SQL> SELECT capability_name, possible, msgtxt
      2  FROM   mv_capabilities_table
      3  WHERE  capability_name LIKE '%REFRESH_FAST_AFTER%';
    CAPABILITY_NAME                P MSGTXT
    REFRESH_FAST_AFTER_INSERT      N the SELECT list does not have the rowids of all the detail tables
    REFRESH_FAST_AFTER_INSERT      N mv log must have ROWID
    REFRESH_FAST_AFTER_INSERT      N mv log must have ROWID
    REFRESH_FAST_AFTER_ONETAB_DML  N see the reason why REFRESH_FAST_AFTER_INSERT is disabled
    REFRESH_FAST_AFTER_ANY_DML     N see the reason why REFRESH_FAST_AFTER_ONETAB_DML is disabled
    SQL> DROP MATERIALIZED VIEW LOG ON dept;
    Materialized view log dropped.
    SQL> DROP MATERIALIZED VIEW LOG ON emp;
    Materialized view log dropped.
    SQL> DROP MATERIALIZED VIEW emp_mvw;
    Materialized view dropped.
    SQL> CREATE MATERIALIZED VIEW LOG ON dept
      2    WITH ROWID, SEQUENCE
      3      INCLUDING NEW VALUES;
    Materialized view log created.
    SQL> CREATE MATERIALIZED VIEW LOG ON emp
      2    WITH ROWID,SEQUENCE
      3      INCLUDING NEW VALUES;
    Materialized view log created.
    SQL> CREATE MATERIALIZED VIEW emp_mvw
      2    REFRESH FAST ON COMMIT
      3  AS
      4  SELECT a.ROWID emp_rowid, b.ROWID dept_rowid,
      5         a.empno, a.ename, a.deptno,
      6         a.job, a.mgr, a.hiredate,
      7       a.sal, a.comm, b.dname, b.loc
      8  FROM   emp a,dept b
      9  WHERE  a.deptno = b.deptno;
    Materialized view created.
    SQL> DELETE mv_capabilities_table;
    18 rows deleted.
    SQL> EXEC DBMS_MVIEW.EXPLAIN_MVIEW ('EMP_MVW');
    PL/SQL procedure successfully completed.
    SQL> SELECT capability_name, possible, msgtxt
      2  FROM   mv_capabilities_table
      3  WHERE  capability_name LIKE '%REFRESH_FAST_AFTER%';
    CAPABILITY_NAME                P MSGTXT
    REFRESH_FAST_AFTER_INSERT      Y
    REFRESH_FAST_AFTER_ONETAB_DML  Y
    REFRESH_FAST_AFTER_ANY_DML     Y
    SQL>

  • Refresh materialized view using workflow

    Hi forum,
    I want to refresh some materialized views using oracle workflow.
    The dbms_mview.refresh is not in de list of public transformations when using the transformation activity.
    Does anybody have any suggestion / solution?
    Thanks in advance,
    Eric

    Hello, Eric
    Try to import dbms_mview package into OWB repository and use them directly.
    The second, easy way - just wrap dbms_mview.refresh into private transformation and use it within your process. I use it in my projects - it works ok.

  • Create a materialized view :-

    How do I create a materialized view on a view ,so that it will refresh automatically on every commit in base table where the view having more that 9 function ?

    Read Materialized View Refresh for complete information.
    For a Jist:
    Refresh Mode Description
    ON COMMIT
    Refresh occurs automatically when a transaction that modified one of the materialized view's detail tables commits. This can be specified as long as the materialized view is fast refreshable (in other words, not complex). The ON COMMIT privilege is necessary to use this mode.
    ON DEMAND
    Refresh occurs when a user manually executes one of the available refresh procedures contained in the DBMS_MVIEW package (REFRESH, REFRESH_ALL_MVIEWS, REFRESH_DEPENDENT).
    When a materialized view is maintained using the ON COMMIT method, the time required to complete the commit may be slightly longer than usual. This is because the refresh operation is performed as part of the commit process. Therefore this method may not be suitable if many users are concurrently changing the tables upon which the materialized view is based.
    If you anticipate performing insert, update or delete operations on tables referenced by a materialized view concurrently with the refresh of that materialized view, and that materialized view includes joins and aggregation, Oracle recommends you use ON COMMIT fast refresh rather than ON DEMAND fast refresh.
    If you think the materialized view did not refresh, check the alert log or trace file.
    If a materialized view fails during refresh at COMMIT time, you must explicitly invoke the refresh procedure using the DBMS_MVIEW package after addressing the errors specified in the trace files. Until this is done, the materialized view will no longer be refreshed automatically at commit time.

  • Inserting a Flag value in to a table using Procedure

    Hi All-
    we are trying to write a procedure which can refresh Materialized views in the database and upon success full refresh it should insert a flag value say 'Y' or 'N' into a table can you guys give me your thoughts.

    Earlier, you said
    while i am trying to execute that one it is giving me an error.Multiple people have asked you to tell us what error you received. It is very difficult for us to guess the error that you're receiving and to then guess the solution. Perhaps you don't have permission to the DBMS_SNAPSHOT package, perhaps you mis-spelled the name of the materialized view, perhaps you don't own the materialized view, etc. If you tell us the error you're getting, it's far more likely that we're going to be able to help.
    Other than the fact that you're using the DBMS_SNAPSHOT package rather than the DBMS_MVIEW package, which I haven't seen done since the 8i days, I don't see anything obviously wrong with your implementation. As has been pointed out, the design is problematic-- it makes little sense to record in your own table less information than Oracle will record automatically in the data dictionary and to spend time writing additional code to do that lesser level of logging.
    Justin

  • Trying to understand...

    ... about invalid packages and when they can still be used without error. Let me explain with an example....
    SQL> CREATE TABLE t (val NUMBER);
    Table created.
    SQL>
    SQL> INSERT INTO t SELECT ROWNUM FROM DUAL CONNECT BY ROWNUM <= 200;
    200 rows created.
    SQL> CREATE OR REPLACE PACKAGE test2 IS
      2    PROCEDURE do_test2;
      3  END test2;
      4  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY test2 IS
      2    PROCEDURE do_test2 IS
      3      CURSOR cur_test IS
      4        SELECT * FROM t;
      5
      6      tot NUMBER := 0;
      7    BEGIN
      8      FOR i IN cur_test
      9      LOOP
    10        tot := tot + i.val;
    11      END LOOP;
    12      DBMS_OUTPUT.PUT_LINE('Total: '||tot);
    13    END;
    14  END test2;
    15  /
    Package body created.
    SQL> set serveroutput on
    SQL> exec test2.do_test2;
    Total: 20100
    PL/SQL procedure successfully completed.
    -- rename the table used by the package to invalidate it.
    SQL> RENAME t TO t2;
    Table renamed.
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    -- Rename the table back, the status is still invalid as the package hasn't been recompiled yet.
    SQL> RENAME t2 TO t;
    Table renamed.
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    -- Execute the procedure in the package and it is executing ok...
    SQL> exec test2.do_test2;
    Total: 20100
    PL/SQL procedure successfully completed.
    -- And upon checking the status of the package after it has automatically been compiled.
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        VALID
    SQL>But with my real package and code....
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'PKG_MAPPING';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        VALID
    -- Execute the first step of the process in my package which drops and recreates a large materialized view and refreshes a smaller one using the DBMS_MVIEW package
    SQL> exec pkg_mapping.pre_mapping(1);
    PL/SQL procedure successfully completed.
    -- The status of the package has now been invalidated by that processing as expected...
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'PKG_MAPPING';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    -- If it try to run the second stage of the process I get the following error...
    SQL> exec pkg_mapping.pre_mapping(2);
    BEGIN pkg_mapping.pre_mapping(2); END;
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "CRISP_INTELL.PKG_MAPPING" has been invalidated
    ORA-06508: PL/SQL: could not find program unit being called: "CRISP_INTELL.PKG_MAPPING"
    ORA-06512: at line 1
    -- After this error, the state of the package is still invalid...
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'PKG_MAPPING';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    -- ... but running it a second time, it executes correctly and the package becomes valid in the process...
    SQL> exec pkg_mapping.pre_mapping(2);
    PL/SQL procedure successfully completed.
    SQL>So I know I must be missing something here. What is it that determines that you get the "ORA-04068: existing state of packages has been discarded" error rather than it just attempting to compile and run the procedure in the package, as happened in the test example?
    Anybody any ideas?

    I guess the only way to get around this is to take the package level variables out of the package and put those into a seperate packageif the global variables are not required across multiple client calls, you can avoid it like below:
    SQL> CREATE TABLE t (val NUMBER);
    Table created.
    SQL>
    SQL> INSERT INTO t SELECT ROWNUM FROM DUAL CONNECT BY ROWNUM <= 200;
    200 rows created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE test2 IS
      2    PROCEDURE do_test2;
      3  END test2;
      4  /
    Package created.
    SQL> show errors
    No errors.
    SQL> CREATE OR REPLACE PACKAGE BODY test2 IS
      2    x NUMBER ;
      3    PROCEDURE do_test2 IS
      4      CURSOR cur_test IS
      5        SELECT * FROM t;
      6
      7      tot NUMBER := 0;
      8    BEGIN
      9      FOR i IN cur_test
    10      LOOP
    11        tot := tot + i.val;
    12      END LOOP;
    13      DBMS_OUTPUT.PUT_LINE('Total: '||tot);
    14    END;
    15  END test2;
    16  /
    Package body created.
    SQL> show errors
    No errors.
    SQL>
    SQL> set serveroutput on
    SQL> exec test2.do_test2;
    Total: 20100
    PL/SQL procedure successfully completed.
    SQL> RENAME t TO t2;
    Table renamed.
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    2 rows selected.
    SQL> RENAME t2 TO t;
    Table renamed.
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    2 rows selected.
    SQL> exec test2.do_test2;
    BEGIN test2.do_test2; END;
    ERROR at line 1:
    ORA-04068: existing state of packages has been discarded
    ORA-04061: existing state of package body "KKISHORE.TEST2" has been invalidated
    ORA-06508: PL/SQL: could not find program unit being called: "KKISHORE.TEST2"
    ORA-06512: at line 1
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    2 rows selected.
    SQL>
    SQL> DROP TABLE t ;
    Table dropped.
    SQL> CREATE TABLE t (val NUMBER);
    Table created.
    SQL>
    SQL> INSERT INTO t SELECT ROWNUM FROM DUAL CONNECT BY ROWNUM <= 200;
    200 rows created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE test2 IS
      2    PROCEDURE do_test2;
      3  END test2;
      4  /
    Package created.
    SQL> show errors
    No errors.
    SQL> CREATE OR REPLACE PACKAGE BODY test2 IS
      2    x NUMBER ;
      3    PROCEDURE do_test2 IS
      4      CURSOR cur_test IS
      5        SELECT * FROM t;
      6
      7      tot NUMBER := 0;
      8    BEGIN
      9      FOR i IN cur_test
    10      LOOP
    11        tot := tot + i.val;
    12      END LOOP;
    13      DBMS_OUTPUT.PUT_LINE('Total: '||tot);
    14    END;
    15  BEGIN
    16 dbms_session.reset_package ;
    17  END test2;
    18  /
    Package body created.
    SQL> show errors
    No errors.
    SQL>
    SQL> set serveroutput on
    SQL> exec test2.do_test2;
    PL/SQL procedure successfully completed.
    SQL> RENAME t TO t2;
    Table renamed.
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    2 rows selected.
    SQL> RENAME t2 TO t;
    Table renamed.
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        INVALID
    2 rows selected.
    SQL> exec test2.do_test2;
    PL/SQL procedure successfully completed.
    SQL> SELECT object_type, status FROM USER_OBJECTS WHERE object_name = 'TEST2';
    OBJECT_TYPE         STATUS
    PACKAGE             VALID
    PACKAGE BODY        VALID
    2 rows selected.
    SQL>

  • Materialized View with OLAP table function

    Hi,
    I am trying to materialize OLAP cubes into relational materialized views which works quite fine. After a few loadings in background in parallel with Database Jobs and DBMS_MVIEW package the peformance is getting poor. Steps I am performing:
    1. Generate materialized view as DEFERRED and COMPLETE refresh
    2. Generate database Jobs for refreshing views with DBMS_MVIEW.REFRESH function
    3. Running Jobs in background
    I have loading times the first time 10min after then over 4 hours. I also tried with ATOMIC_REFRESH=FALSE but the same result. Database is running in ARCHIVE LOGGING. Can this degrade the performance?
    Any ideas?
    Thanks,
    Christian

    Hi,
    yes thats correct. I am creating MVs in 10.2.0.3
    Here is an example:
    CREATE MATERIALIZED VIEW "FCRSGX"."MV_F_ICCC_C11"
    ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 COMPRESS NOLOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "FCRSGX_CONSO_RELATIONAL"
    BUILD DEFERRED
    USING INDEX
    REFRESH COMPLETE ON DEMAND
    USING DEFAULT LOCAL ROLLBACK SEGMENT
    DISABLE QUERY REWRITE
    AS SELECT ENTITY, REVE_ICC, RP_ICC, MV_ICC, PERIOD, MEASURE, AMOUNT, R2C
    FROM TABLE(OLAP_TABLE('FCRSGX.CONSODATA DURATION SESSION',
    DIMENSION ENTITY as varchar2(8) FROM ENTITY
    DIMENSION REVE_ICC as varchar2(8) FROM REVE_ICC
    DIMENSION RP_ICC as varchar2(8) FROM RP_ICC
    DIMENSION MV_ICC as varchar2(8) FROM MV_ICC
    DIMENSION PERIOD as varchar2(8) FROM GMONTH
    DIMENSION MEASURE as varchar2(30) FROM EXPR
    MEASURE AMOUNT as number FROM ICCC.C11
    LOOP CMPE.ICCC.C11
    ROW2CELL R2C '))
    WHERE OLAP_CONDITION(r2c, 'lmt entity to CMPE.ICCC.C11')=1
    AND OLAP_CONDITION(r2c, 'lmt reve_icc to CMPE.ICCC.C11')=1
    AND OLAP_CONDITION(r2c, 'lmt mmonth to sapload.per eq y')=1
    AND OLAP_CONDITION(r2c, 'lmt gmonth to charl(mmonth) ')=1
    AND OLAP_CONDITION(r2c, 'lmt rp_icc to CMP.ICCC.C11 ')=1
    AND OLAP_CONDITION(r2c, 'lmt mv_icc to CMP.ICCC.C11 ')=1
    AND OLAP_CONDITION(r2c, 'lmt expr to ''F.ICCC.C11'' ')=1
    MODEL
    DIMENSION BY(ENTITY,REVE_ICC,RP_ICC,MV_ICC,PERIOD,MEASURE)
    MEASURES(AMOUNT,R2C)
    RULES UPDATE SEQUENTIAL ORDER()
    ;

  • Materialized Views Not Refreshing

    I have created several materialized views and I am having a problem with them never refreshing even though their refresh times are specified in the create statement. Here is the SQL statement for one of them.
    create MATERIALIZED view autonomy_mvw
         nocache
         logging
         noparallel
         build immediate
         refresh complete
         start with to_date(sysdate,'dd-mon-yyyy hh24:mi:ss')
         next sysdate + 18/24
    as
         select c.contract_seq,
              c.contract_number contract,
    cast('' as VARCHAR2(1)) contract_mod,
              cast('' as VARCHAR2(1)) do,
              cast('' as VARCHAR2(1)) do_seq,
              cast('' as VARCHAR2(1)) do_mod_number,
              c.contract_number co_do,
              c.contract_name title,
              c.contract_remarks description,
              c.contract_effective_date award_date,
              to_char(c.contract_performance_end_date) originalpop,
              to_char(cont_perform_end_date(c.contract_seq)) currentpop,
              c.control_group controlgroup,
              c.fiscal_year_execution fy,
    c.quarter,
              nvl(CON_PENDING_ROLLUP_AMOUNT(c.contract_seq),0) pendingamt,
              nvl(CON_OBLIGATED_ROLLUP_AMOUNT(c.contract_seq),0) originalamt,
              cont_majcoms_comma(c.contract_seq) majcom,
    cont_installations_desc_comma(c.contract_seq) installation,
              case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
              else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end     pm,
              case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
              else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'')     end cm,
              case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
              else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
              con.contractor_name contractor,
              c.contract_status status,
              cast('' as VARCHAR2(1)) active_status,
              nvl(c.prg_name,'Non Program') prg_name,
              c.funds_type fund_type,
              c.contract_instr_num
         from contract c,
              contractor con,
              cg_level cgl,
              poc_user_info pocPM,
              poc_user_info pocCM,
              poc_user_info pocBCO
         where c.contractor_number = con.contractor_number
         and c.control_group = cgl.control_group(+)
         and c.pm_seq = pocPM.poc_user_seq(+)
         and c.cm_seq = pocCM.poc_user_seq(+)
         and c.bco_seq = pocBCO.poc_user_seq(+)
         and c.contract_instr_num <> 'D'
         and c.contract_status in ('AC', 'NEW')     
         union
         select c.contract_seq,
              c.contract_number contract,
              cmod.contract_mod_num contract_mod,
              cast('' as VARCHAR2(1)) do,
              cast('' as VARCHAR2(1)) do_seq,
              cast('' as VARCHAR2(1)) do_mod_number,
              c.contract_number||'/'||cmod.contract_mod_num co_do,
              c.contract_name title,
              c.contract_remarks description,
              c.contract_effective_date award_date,
              to_char(c.contract_performance_end_date) originalpop,
              to_char(cont_perform_end_date(c.contract_seq)) currentpop,
              c.control_group controlgroup,
              cmod.fiscal_year_execution fy,
    cmod.quarter,
              nvl(cmod.contract_mod_committed_amt,0) pendingamt,
              nvl(cmod.afcee_oblig_contract_mod_amt, 0) originalamt,
              cont_majcoms_comma(c.contract_seq) majcom,
              cont_installations_desc_comma(c.contract_seq) installation,
              case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
              else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
              case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
              else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
              case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
              else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
              con.contractor_name contractor,
              c.contract_status status,
              cast('' as VARCHAR2(1)) active_status,
              nvl(c.prg_name,'Non Program') prg_name,
              c.funds_type fund_type,
              c.contract_instr_num
         from contract c,
              contract_modification cmod,
              contractor con,
              cg_level cgl,
              poc_user_info pocPM,
              poc_user_info pocCM,
              poc_user_info pocBCO
         where c.contract_seq = cmod.contract_seq
         and c.contractor_number = con.contractor_number
         and c.control_group = cgl.control_group(+)
         and c.pm_seq = pocPM.poc_user_seq(+)
         and c.cm_seq = pocCM.poc_user_seq(+)
         and c.bco_seq = pocBCO.poc_user_seq(+)
         and c.contract_instr_num <> 'D'
         and c.contract_status in ('AC', 'NEW')
         union
         select c.contract_seq,
              c.contract_number contract,
              cast('' as VARCHAR2(1)) contract_mod,
              do.do_number do,
              to_char(do.do_seq) do_seq,
              cast('' as VARCHAR2(1)) do_mod,
              c.contract_number||'-'||do.do_number co_do,
              do.do_title title,
              do.do_description description,
              do.afcee_obligated_do_date award_date,
              to_char(do.do_end_date) originalpop,
         to_char(do_mod_end_date(do.do_seq)) currentpop,
              do.control_group controlgroup,
              do.fiscal_year_execution fy,
    do.quarter,
              nvl(DO_PENDING_ROLLUP_AMOUNT(do.do_seq),0) pendingamt,
              nvl(DO_OBLIGATED_ROLLUP_AMOUNT(do.do_seq),0) originalamt,
    do_majcoms_comma(do.do_seq, null) majcom,
    do_installations_desc_comma(do.do_seq, null) installation,
              case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
              else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
              case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
              else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
              case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
              else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
              con.contractor_name contractor,
              do.do_status status,
              do.do_actv_status active_status,
              nvl(c.prg_name,'Non Program') prg_name,
              do_fundtypes_comma(do.do_seq,null) fund_type,
              c.contract_instr_num
         from delivery_order do,
              contract c,
              contractor con,
              cg_level cgl,
              poc_user_info pocPM,
              poc_user_info pocCM,
              poc_user_info pocBCO
         where do.contract_seq = c.contract_seq
         and c.contractor_number = con.contractor_number
         and do.control_group = cgl.control_group(+)
         and do.pm_seq = pocPM.poc_user_seq(+)
         and do.cm_seq = pocCM.poc_user_seq(+)
         and do.bco_seq = pocBCO.poc_user_seq(+)
         and do.do_status in ('CURR')
         and do.do_actv_status in ('RESV','ANTC','FORE','COMM','OBLG','FIN_INV')
         union
         select c.contract_seq,
              c.contract_number contract,
              ''contract_mod,
              do.do_number do,
              to_char(do.do_seq) do_seq,
              domod.do_mod_number do_mod,
              c.contract_number||'-'||do.do_number||'-'||domod.do_mod_number co_do,
              do.do_title title,
              domod.do_mod_description description,
              domod.afcee_obligated_do_mod_date award_date,
              to_char(do.do_end_date) originalpop,
    to_char(do_mod_end_date(do.do_seq)) currentpop,
              domod.control_group controlgroup,
              domod.fiscal_year_execution fy,
    domod.quarter,
              (nvl(domod.do_mod_committed_amount,0) + nvl(domod.reserved_amount,0)+ nvl(domod.anticipated_amount,0)
                   + nvl(domod.forecasted_amount,0)) pendingamt,
              (nvl(domod.afcee_obligated_do_mod_amount, 0)) originalamt,
    do_majcoms_comma(do.do_seq, domod.do_mod_number) majcom,
    do_installations_desc_comma(do.do_seq, domod.do_mod_number) installation,
              case pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') when ', ' then 'Not Assigned'
              else pocPM.last_name || ', ' || pocPM.first_name || nvl2(pocPM.mi,' '||pocPM.mi,'') end pm,
              case pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') when ', ' then 'Not Assigned'
              else pocCM.last_name || ', ' || pocCM.first_name || nvl2(pocCM.mi,' '||pocCM.mi,'') end cm,
              case pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') when ', ' then 'Not Assigned'
              else pocBCO.last_name || ', ' || pocBCO.first_name || nvl2(pocBCO.mi,' '||pocBCO.mi,'') end BCO,
              con.contractor_name contractor,
              do.do_status status,
              do.do_actv_status active_status,
              nvl(c.prg_name,'Non Program') prg_name,
              do_fundtypes_comma(do.do_seq,domod.do_mod_number) fund_type,
              c.contract_instr_num
         from delivery_order do,
              delivery_order_modification domod,
              contract c,
              contractor con,
              cg_level cgl,
              poc_user_info pocPM,
              poc_user_info pocCM,
              poc_user_info pocBCO
         where do.do_seq = domod.do_seq
         and do.contract_seq = c.contract_seq
         and c.contractor_number = con.contractor_number
         and do.control_group = cgl.control_group(+)
         and do.pm_seq = pocPM.poc_user_seq(+)
         and do.cm_seq = pocCM.poc_user_seq(+)
         and do.bco_seq = pocBCO.poc_user_seq(+)
         and domod.do_mod_status in ('CURR')
         and domod.do_mod_actv_status in ('RESV','ANTC','FORE','COMM','OBLG','DEOBLG','FIN_INV');
    As you can see, I cannot use the On Commit refresh method because I violate several of the requirements in order to use the On Commit refresh method. I do not have a materialized view logs.
    I did the following select from all_mviews:
    1 select
    2 MVIEW_NAME,
    3 UPDATABLE,
    4 UPDATE_LOG,
    5 REWRITE_ENABLED,
    6 REWRITE_CAPABILITY,
    7 REFRESH_MODE,
    8 REFRESH_METHOD,
    9 BUILD_MODE,
    10 LAST_REFRESH_TYPE,
    11 LAST_REFRESH_DATE,
    12 STALENESS
    13 from all_mviews
    14* where mview_name = 'AUTONOMY_MVW'
    MVIEW_NAME U UPDATE_LOG R REWRITE_C REFRES REFRESH_ BUILD_MOD LAST_REF LAST_REFR STALENESS
    AUTONOMY_MVW N N NONE DEMAND COMPLETE IMMEDIATE COMPLETE 17-NOV-05 STALE
    I then called the dbms_mview package to force a REFRESH on this view and then re-ran the above sql
    MVIEW_NAME U UPDATE_LOG R REWRITE_C REFRES REFRESH_ BUILD_MOD LAST_REF LAST_REFR STALENESS
    AUTONOMY_MVW N N NONE DEMAND COMPLETE IMMEDIATE COMPLETE 04-MAY-06 STALE
    I noticed that while it was refreshed it shows as stale.
    How do I get this materialized view (and my other ones) to refresh in a regular manner?
    Thanks
    Richard Anderson

    Here is what I got when I ran the sql you provided. BTW, I increased the substr size for the "Command" to 70 so I could see the whole thing. I have 6 materialized views in this instance but one of them has a compile_state of "ERROR" and so it doesn't show in the job queue. All the others show up.
    Job User Schem Last Date Next Date B Failed Command
    9 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_CON_DO_REPORT_MVW"');
    51 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."MIEN_FY_MV"');
    4 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_ALL_STATUS_AMT_REPORT_MVW"');
    7 MXT MXT 04.05.2006 16:55 04.05.2006 17:55 N 0 dbms_refresh.refresh('"MXT"."PMR_AMOUNT_REPORT_MVW"');
    31 MXT MXT 04.05.2006 16:58 04.05.2006 17:28 N 0 dbms_refresh.refresh('"MXT"."PMR_TEST_MVW"');
    Rick Anderson
    PS, this list was run on my DEV server so it doesn't have the AUTONOMY_MVW at all but both my DEV and PROD instances are having the same issues.
    I downloaded Oracle SQL Developer and used it to look at the materialized views and they have a details tab which contained the following:
    "Name"     "Value"
    "OWNER"     "MXT"
    "MVIEW_NAME"     "PMR_AMOUNT_REPORT_MVW"
    "CONTAINER_NAME"     "PMR_AMOUNT_REPORT_MVW"
    "QUERY_LEN"     "31020"
    "UPDATABLE"     "N"
    "UPDATE_LOG"     ""
    "MASTER_ROLLBACK_SEG"     ""
    "MASTER_LINK"     ""
    "REWRITE_ENABLED"     "N"
    "REWRITE_CAPABILITY"     "NONE"
    "REFRESH_MODE"     "DEMAND"
    "REFRESH_METHOD"     "COMPLETE"
    "BUILD_MODE"     "IMMEDIATE"
    "FAST_REFRESHABLE"     "NO"
    "LAST_REFRESH_TYPE"     "COMPLETE"
    "LAST_REFRESH_DATE"     "04-MAY-06"
    "STALENESS"     "UNKNOWN"
    "AFTER_FAST_REFRESH"     "NA"
    "UNKNOWN_PREBUILT"     "N"
    "UNKNOWN_PLSQL_FUNC"     "Y"
    "UNKNOWN_EXTERNAL_TABLE"     "N"
    "UNKNOWN_CONSIDER_FRESH"     "N"
    "UNKNOWN_IMPORT"     "N"
    "COMPILE_STATE"     "VALID"
    "USE_NO_INDEX"     "N"
    Message was edited by:
    RichardAnderson

  • Ora-23404:refresh group HR.MV_EMP does not exist

    Hi,
    i am getting following error when refreshing materialized view ,
    exec dbms_refresh.refresh('HR.MV_EMP');
    ORA-23404: refresh group "HR.MV_EMP" does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_REFRESH", line 23
    ORA-06512: at "SYS.DBMS_REFRESH", line 195
    ORA-06512: at line 1
    Thanks,

    Mohammed,
    The DBMS_REFRESH package works on groups of materialized views, not single views. The argument you pass should be the name of a group of views, not the name of a view. There is no group called MV_EMP, hence the error.
    To use this you would need to create a group using:
    DBMS_REFRESH.MAKE (groupname, view_list, parameter_list)
    where view_list is a list of materialized views to include in the group, and parameter_list defines various properties of the group, including when it is refreshed.
    followed by:
    DBMS_REFRESH.REFRESH (groupname)
    See this link for further information:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14227/rarrefreshpac.htm#i94057
    If you just want to refresh this single view, though, it is better to use the DBMS_MVIEW package:
    DBMS_MVIEW.REFRESH ('HR.MV_EMP')
    Edited by: user10827032 on 20-Jan-2009 07:10

  • My update query is taking more tablespace.. so please advice

    Hi All,
    My update statement is taking more tablespace suddently. so I got error 'unable to extend the tablespace'. After extended the tablespace, I got completed..but those extended tablespace also got filled immetiately. Can you guys please suggest me for some solutions for this case.
    "-- Proc to update the lvl 2 dfus in the dfuprojdraftstatic table with cust orders
    procedure update_lvl2_dpds_custorders is
    cv cur_type;
    v_lvl1_dmdgroup varchar2(50) := null;
    v_lvl1_loc varchar2(50) := null;
    v_first_one number;
    a number;
    begin
    for x in (select distinct dmdgroup lvl2_dmdgroup, loc lvl2_loc
    from dfuprojdraftstatic s
    where (dmdunit,dmdgroup,loc) in (select dmdunit,dmdgroup,loc from dfuview v
    where u_dfu_lvl = 2)
    and dmdunit in (select dmdunit from dmdunit
    where u_moe = in_moe) ) loop
    v_first_one := 1;
    -- Using dynamic sql, loop through the lvl 1 dmdgroups and locs for this lvl 2 dmdgroup and loc
    --open cv for v_sql_stmt using v_cntry_cd, x.lvl2_dmdgroup, v_cntry_cd, x.lvl2_loc;
    open cv for v_sql_stmt using x.lvl2_dmdgroup,in_moe;
    loop
    fetch cv into v_lvl1_dmdgroup, v_lvl1_loc;
    exit when cv%notfound;
    UPDATE dfuprojdraftstatic s
    SET u_cust_ordr = (SELECT decode(v_first_one, 1, 0, u_cust_ordr) + nvl(sum(qty), 0)
    FROM cust_orders o, mars_week_cal c
    WHERE o.mrkt_moe = in_moe
    AND o.dmdunit = s.dmdunit
    AND o.dmdgroup = v_lvl1_dmdgroup
    AND o.loc = v_lvl1_loc
    AND o.start_date BETWEEN c.week_start_dat AND c.week_end_dat
    AND c.week_start_dat = s.startdate
    WHERE startdate >= v_max_dpd
    AND (dmdunit,dmdgroup,loc) in (select dmdunit,dmdgroup,loc from dfuview v
    where u_dfu_lvl = 2 )
    AND dmdunit in (select dmdunit from dmdunit
    where u_moe = in_moe )
    AND s.dmdgroup = x.lvl2_dmdgroup
    AND s.loc = x.lvl2_loc;
    dbms_output.put_line('A '||a+1);
    if v_first_one = 1 then
    v_first_one := 0;
    end if;
    end loop;
    close cv;
    end loop;
    commit;
    end; -- update_lvl2_dpds_custorders
    Thanks and Regards,
    Sudhakar.M

    Without seeing the full code like, for example, the definition of v_sql_stmt, and without knowing you tables and data, my guess would be that, based on the code provided, the update process is extremely inefficient and is likely updating the same row multiple times in this procedure, and even more likely in the entire set of provedures.
    Based on the erro message, it appears that you are running a package called batch_upd_dfuprojdraftstatic. Based on the name of the procedure you show, I also suspect that there are several other procedures that update single columns of dfuprojdraftstatic one after the other.
    I know that the table dfuprojdraftstatic is at least part of the base for a materialized view (mlog$_dfuprojdraftstatic is the materialized view log attached to the table to track changes for refreshing the materialized view). For each update you issue, Oracle creates a record in the materialized view log tracking what changed. If you do update col1, that creates a record in the log for each row , if you subsequently do update col2 that creates a second record for each row. However, if you do update col1, col2, that only creates a single record for each row. So, updating all of the columns requiring updates at the same time will reduce the number of the materialized view log entries, which should reduce the space required.
    You may alos want to loko at purging some of the data form the log using the dbms_mview package.
    John

  • Reg:package code to refresh materialized views

    i am new to pl/sql packages and procedures.i want it to execute for running mappings in informatica which takes 0 and gives 1 when executed successfully
    create or replace PACKAGE BODY pkg_refresh_mv as
    procedure prc_mv (p_mv_name varchar2) is
    begin
    dbms_mview.refresh (p_mv_name);
    end prc_mv;
    procedure refresh_all_mv (proc_response IN OUT number) is
    begin
    dbms_mview.refresh('materialized view','C');
    dbms_mview.refresh('materialized view','C');
    proc_response := 1;
    exception
    when others then
    proc_response := 0;
    end refresh_all_mv ;
    end pkg_refresh_mv;
    when i execute this code i get the following errors
    PLS-00201: identifier 'PKG_REFRESH_MV' must be declared
    PLS-00304: cannot compile body of 'PKG_REFRESH_MV' without its specification
    what needs to be changed
    thanks

    try this one :
    CREATE OR REPLACE PACKAGE pkg_refresh_mv
    AS
       PROCEDURE prc_mv (p_mv_name VARCHAR2);  
       PROCEDURE refresh_all_mv (proc_response IN OUT NUMBER);
    END pkg_refresh_mv;
    CREATE OR REPLACE PACKAGE BODY pkg_refresh_mv
    AS
       PROCEDURE prc_mv (p_mv_name VARCHAR2)
       IS
       BEGIN
          dbms_mview.refresh (p_mv_name);
       END prc_mv;
       PROCEDURE refresh_all_mv (proc_response IN OUT NUMBER)
       IS
       BEGIN
          dbms_mview.refresh ('materialized view', 'C');
          dbms_mview.refresh ('materialized view', 'C');
          proc_response := 1;
       EXCEPTION
          WHEN OTHERS
          THEN
             proc_response := 0;
       END refresh_all_mv;
    END pkg_refresh_mv;
    /

  • Refresh Materialized View in a package

    Refresh Materialized View in a process.
    I have a USER2.Materialized view and when I want to refresh it I execute:
    execute dbms_mview.refresh('MV_FACT_SALES','C');
    But I have the ETL process in a USER1.package
    The User1 needs any Materialized View Grant or any privilegie?
    How can I refresh the Materialized View in a procedure in the USER1.package?

    I 'm sorry, but I want to create a procedure under USER2 and when I execute the script to create it I receive the error:
    ORA-06550: line 4, column 12:
    PLS-00103: Encountered the symbol "DBMS_MVIEW" when expecting one of the following:
    := . ( @ % ; immediate
    The symbol ":=" was substituted for "DBMS_MVIEW" to continue.
    Te script procedure is:
    PROCEDURE REFRESH_MV IS
    BEGIN
    execute dbms_mview.refresh('MV_FACT_SALES','C');
    END;
    How can I refresh a Materialized view in a procedure?
    Thanks!

  • DBMS_MVIEW.ESTIMATE_MVIEW_SIZE rows returned different that the count of..

    Hi,
    I have done the following...
    1.Gathered table stats...
    SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS('SCOTT','STRDET');
    PL/SQL Procedure executed successfully
    SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS('SCOTT','DETAILS_DET');
    PL/SQL Procedure executed successfully
    2. Executed the following anonymous PL/SQL block:
    SQL> set serveroutput on size 999999
    SQL> declare
      2     l_num_rows  number;
      3     l_num_bytes number;
      4     l_stmt      varchar2(2000);
      5  begin
      6     l_stmt := 'select  grp,
      7              sum(purchcontyear0) , sum(PURCHAPPRREQYEAR0)
      8        from  (
      9               select  connect_by_root s.costcenterms grp,
    10                       d.purchcontyear0 , PURCHAPPRREQYEAR0
    11                 from  strdet s,
    12                       details_det d
    13                      where s.costcenterdet=d.costcenterms(+)
    14                      connect by s.costcenterms = prior s.costcenterdet
    15             )
    16       group by grp';
    17     dbms_mview.estimate_mview_size
    18     (
    19        stmt_id       => 'Est1',
    20        select_clause => l_stmt,
    21        num_rows      => l_num_rows,
    22        num_bytes     => l_num_bytes
    23     );
    24     dbms_output.put_line('Number of rows = '||l_num_rows);
    25     dbms_output.put_line('Size (bytes) = '||l_num_bytes);
    26  end;
    27  /
    Number of rows = 12
    Size (bytes) = 1248
    3. Executed the sql script ...
    SQL> select count(*)
      2  from
      3  (
      4   select  grp,
      5              sum(purchcontyear0) , sum(PURCHAPPRREQYEAR0)
      6        from  (
      7               select  connect_by_root s.costcenterms grp,
      8                       d.purchcontyear0 , PURCHAPPRREQYEAR0
      9                 from  strdet s,
    10                       details_det d
    11                      where s.costcenterdet=d.costcenterms(+)
    12                      connect by s.costcenterms = prior s.costcenterdet
    13             )
    14       group by grp
    15  )
    16  /
      COUNT()*
             *6*According to the Oracle Doc...
    Oracle® Database PL/SQL Packages and Types Reference
    10g Release 2 (10.2)
    Part Number B14258-01
    ESTIMATE_MVIEW_SIZE Procedure
    This procedure estimates the size of a materialized view that you might create, in bytes and number of rows.Can anybody explain why is there so much difference in number of rows...even though i gathered freshed table stats regarding the source table....???? and how to , if possible , make the estimation more precise...????
    NOTE: The above is just a wonder.....
    Many thanks...
    Sim

    Hi,
    SQL> create table dup as select * from user_objects;
    Table created.
    SQL> insert into dup select * from dup;
    7 rows created.
    SQL> /
    14 rows created.
    SQL> /
    28 rows created.
    SQL> /
    56 rows created.
    SQL> /
    112 rows created.
    SQL> /
    224 rows created.
    SQL> /
    448 rows created.
    SQL> commit;
    Commit complete.
    SQL> desc dup
    Name                                      Null?    Type
    OBJECT_NAME                                        VARCHAR2(128)
    SUBOBJECT_NAME                                     VARCHAR2(30)
    OBJECT_ID                                          NUMBER
    DATA_OBJECT_ID                                     NUMBER
    OBJECT_TYPE                                        VARCHAR2(19)
    CREATED                                            DATE
    LAST_DDL_TIME                                      DATE
    TIMESTAMP                                          VARCHAR2(19)
    STATUS                                             VARCHAR2(7)
    TEMPORARY                                          VARCHAR2(1)
    GENERATED                                          VARCHAR2(1)
    SECONDARY                                          VARCHAR2(1)
    SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS('SCOTT','DUP');
    PL/SQL procedure successfully completed.
    SQL> DECLARE
      2   out_rows   NUMBER;
      3   out_bytes  NUMBER;
      4  BEGIN
      5    dbms_mview.estimate_mview_size('abc',
      6    'SELECT * FROM DUP', out_rows, out_bytes);
      7
      8    dbms_output.put_line(out_rows);
      9    dbms_output.put_line(out_bytes);
    10  END;
    11  /
    896
    236544
    PL/SQL procedure successfully completed.
    SQL> select count(*) FROM DUP;
      COUNT(*)
           896
    1 row selected.
    SQL>Can you check your query once...
    - Pavan Kumar N

Maybe you are looking for

  • Is there a way to stop Firefox from suggesting to add new search engines to my search bar?

    Is there a way to stop Firefox from suggesting to add new search engines to my search bar whenever I visit websites that suggest to us to add their search engines? I searched a lot and couldn't find any help. How to stop websites from suggesting to m

  • How can I get by external hard drive to be seen by other computers on the Airport Extreme Network

    I purchased and installed an Airport Extreme yesterday.  I finally got my computers to find it, but I cannot get my wireless laptop to connect to the external hard drive that is connected to the AE using a Cat5 cable.  I have already verified that th

  • Possible to hide JFrame yet show on task bar?

    Hello All, Is this possible? I would like to show the JFrame button on the taskbar, but not show the JFrame itself. This is because there is a JDialog to show, but if the user alternates windows, he is liable to lose the JDialog, unless he presses Al

  • UPgrade qs from 4.6 c to ECC 6.0

    My client is looking to move from 4.6C to ECC 6.0. Now, it is using BAs as the legal entities instead of compay codes, its also using Internal Orders to capture all the revenue and cost centers for expenses as well as balance sheet items (changing th

  • New photos replaced old photos??!!

    Hello, I imported pics from a recent vacation from an older Fuji digital camera that we don't use too much anymore. I was looking through my pics the other day and saw many duplicates of the same vacation pictures in other non related 'rolls'. The on