title: Materialized view and table with the same name
body: <p>I kind of understand materialized views and have worked with them before. Recently a question came up as to why a particular report didn't show latest data, I looked into the issue. Apparently, they had a temp table loaded with crontab earlier and switched to Materialized view later.</p>
  
  <p>When I looked into the database with the below query (name of the table changed):</p>
  
  <pre><code>SELECT * FROM all_objects WHERE object_name = 'TEMP_DATA';
  </code></pre>
  
  <p>This actually showed 2 objects in the same schema: one table and another materialized view</p>
  
  <pre><code>OWNER   OBJECT_NAME  OBJECT_TYPE        DATA_OBJECT_ID  LAST_DDL_TIME     TIMESTAMP
  SCHEMA  TEMP_DATA    TABLE                      110623  08/06/2013 15:38  2013-08-06:14:53:01
  SCHEMA  TEMP_DATA    MATERIALIZED VIEW                  10/30/2015 00:00  2013-08-06:14:56:33
  </code></pre>
  
  <p>And, when I try to alter the table to rename it, it said materialized view cannot be renamed.</p>
  
  <p>My question is, whether a materialized view actually creates a table with the same name and if so, when I do <code>SELECT</code> where does the data come from (table or MView)?</p>
  
  <p>Or is it just the leftover table from earlier times? If so, does Oracle allow different type of objects with the same name? (I was really stumped by this, as I thought every object had to have a unique name!).</p>
  
  <p>And just curious, if they are 2 objects, which one is used in the below SQL:</p>
  
  <pre><code>SELECT * FROM TEMP_DATA;
  </code></pre>
  
  <p>Any insight into it, much appreciated.</p>
  
  <p><strong>UPDATE</strong> based on @Alex and @Husqvik's responses:
  In the Mview definition, I see below:      </p>
  
  <pre><code>BUILD IMMEDIATE  
  REFRESH COMPLETE  
  START WITH TO_DATE('06-Nov-2015','dd-mon-yyyy')  
  NEXT trunc(sysdate) + 1  
  WITH PRIMARY KEY  
  </code></pre>
  
  <p>Does that mean it should update everyday (here tomorrow)?  Will the <strong>START WITH</strong> change to 07-Nov after tomorrow's refresh?  </p>
  
  <p>And,  does it automatically refresh and if so, when does it do the refresh?  </p>
  
  <p>Is there anything that would prevent it from refreshing, because the user complained they don't see the latest data in a report using this MView and that's why I got this to look at this in the first place?</p>
  
  <p>Here is the full DDL for the MView:</p>
  
  <pre><code>DROP MATERIALIZED VIEW SCHEMA.TEMP_DATA;
  CREATE MATERIALIZED VIEW SCHEMA.TEMP_DATA 
  TABLESPACE ITS_DATASPACE
  PCTUSED    0
  PCTFREE    10
  INITRANS   2
  MAXTRANS   255
  STORAGE    (
              INITIAL          64K
              NEXT             1M
              MINEXTENTS       1
              MAXEXTENTS       UNLIMITED
              PCTINCREASE      0
              BUFFER_POOL      DEFAULT
             )
  NOCACHE
  LOGGING
  NOCOMPRESS
  NOPARALLEL
  BUILD IMMEDIATE
  REFRESH COMPLETE
  START WITH TO_DATE('06-Nov-2015','dd-mon-yyyy')
  NEXT trunc(sysdate) + 1
  WITH PRIMARY KEY
  AS 
  /* Formatted on 2015/11/05 09:35 (Formatter Plus v4.8.8) */
  SELECT *
    FROM SCHEMA.h_case_data
   WHERE status LIKE 'M%';
  
  COMMENT ON MATERIALIZED VIEW SCHEMA.TEMP_DATA IS 'snapshot table for snapshot SCHEMA.TEMP_DATA';
  
  CREATE INDEX SCHEMA.CASE_ID_IDX ON SCHEMA.TEMP_DATA
  (CASE_ID)
  LOGGING
  TABLESPACE ITS_DATASPACE
  PCTFREE    10
  INITRANS   2
  MAXTRANS   255
  STORAGE    (
              INITIAL          64K
              NEXT             1M
              MINEXTENTS       1
              MAXEXTENTS       UNLIMITED
              PCTINCREASE      0
              BUFFER_POOL      DEFAULT
             )
  NOPARALLEL;
  
  CREATE INDEX SCHEMA.STATUS_IDX ON SCHEMA.TEMP_DATA
  (STATUS)
  LOGGING
  TABLESPACE ITS_DATASPACE
  PCTFREE    10
  INITRANS   2
  MAXTRANS   255
  STORAGE    (
              INITIAL          64K
              NEXT             1M
              MINEXTENTS       1
              MAXEXTENTS       UNLIMITED
              PCTINCREASE      0
              BUFFER_POOL      DEFAULT
             )
  NOPARALLEL;
  </code></pre>