title: ORA-22806 (not an object or REF) on Join to a view
body: <p>Here is a fairly simple query that is throwing this error:</p>
  
  <pre><code>SELECT RR.REQUEST_ID
  FROM CCS_REQUEST_RESPONSE RR 
  INNER JOIN VW_STUDENT_CURRENT_AND_HIST VW
  ON RR.STUDENTID = VW.STUDENT_NUMBER
  </code></pre>
  
  <p>This only happens when joining to the view.<br>
  The view is a simple union all of 2 identical tables. 
  When I substitute a single table instead of the view in the above query, it works fine.  </p>
  
  <p>So,  </p>
  
  <pre><code>SELECT RR.REQUEST_ID
  FROM CCS_REQUEST_RESPONSE RR 
  INNER JOIN HISTORICAL_STUDENTS VW
  ON RR.STUDENTID = VW.STUDENT_NUMBER
  </code></pre>
  
  <p>Works just fine.  </p>
  
  <p>And here is the view:  </p>
  
  <pre><code> CREATE OR REPLACE VIEW "VW_STUDENT_CURRENT_AND_HIST" ("STUDENT_NUMBER") AS 
    SELECT "STUDENT_NUMBER"
      FROM HISTORICAL_STUDENTS
  UNION ALL
    SELECT "STUDENT_NUMBER"
        FROM CURRENT_YEAR_STUDENTS;
  </code></pre>
  
  <p>Interesting thing is that this used to work and suddenly stopped. 
  Any ideas?</p>