title: Using a Materialized View with the Master table empty
body: <p>I was executing some tests with the concept of Materialized Views in Oracle and I wasn't able to answer this question, would a Materialized View fetch rows when the master table it was originally created from becomes empty? I have listed a sequence of events below to visualize what I have in mind,</p>
  
  <ol>
  <li>Create a valid Materialized View based on a huge Master table</li>
  </ol>
  
  <p>Here's an example</p>
  
  <p>The Master table</p>
  
  <pre><code>CREATE TABLE master_tab
  (                    
  col1 varchar2(10),         
  col2 varchar2(10), 
  col3 varchar2(10),
  tr_val1 number,
  tr_val2 number,
  tr_val3 number
  )
  </code></pre>
  
  <p>The Materialized View definition</p>
  
  <pre><code>CREATE MATERIALIZED VIEW mview_test
  BUILD IMMEDIATE 
  REFRESH COMPLETE
  ON DEMAND 
  ENABLE QUERY REWRITE
  AS SELECT col1, col2
  SUM(tr_val1), SUM(tr_val2)
  FROM master_tab
  GROUP BY col1, col2
  </code></pre>
  
  <ol start="2">
  <li>At a later point in time, for some reason, the master table master_tab gets truncated</li>
  <li>So, now, only the Materialized View has any data relevant to any query on the Master table master_tab</li>
  </ol>
  
  <p>I wasn't very conversant with what Oracle does behind the scenes to fetch the correct data. Now, what happens when a query gets executed from an application looking for data from the Master table? For example, what happens when an application queries,</p>
  
  <pre><code>SELECT col1, col2
  SUM(tr_val1), SUM(tr_val2)
  FROM master_tab
  GROUP BY col1, col2
  </code></pre>
  
  <ol>
  <li>What kind of decisions does Oracle take internally to fetch data from Materialized Views?</li>
  <li>Would Oracle still retrieve the correct data from the Materialized View even if the Master table is empty?</li>
  <li>If the answer to #2 is yes, does it mean that as long as the Materialized View isn't refreshed again, Oracle will still be able to fetch data for all queries looking for data from the Master?</li>
  </ol>
  
  <p>Thanks for your help</p>