Search code examples
oracleviewmaterialized

ORACLE : Materialized view- change START WITH CLAUSE


I created a Materialized view using the following code:

CREATE MATERIALIZED VIEW M_USER_HIERARCHY 

BUILD IMMEDIATE
REFRESH COMPLETE
START WITH TO_DATE('25-Aug-2009 10:34:24','dd-mon-yyyy hh24:mi:ss')
NEXT SYSDATE + 1     
WITH PRIMARY KEY
AS 
SELECT   * FROM V_USER_HIERARCHY;

However, I want to be able to change the START WITH date AFTER this code has been executed. I have been looking into the ALL_MVIEW_* tables but could not find where the setting for the START_DATE is.

Does anyone know how to change the START_WITH date of a Materialized View ?


Solution

  • It's really quite straightforward.

    SQL> create materialized view emp_data
      2  as select * from emp
      3  /
    
    Materialized view created.
    
    SQL> ALTER MATERIALIZED VIEW emp_data
      2     REFRESH COMPLETE
      3     START WITH TRUNC(SYSDATE+1) + 12/24
      4     NEXT SYSDATE+1
      5  /
    
    Materialized view altered.
    
    SQL>