title: ORA-904 When referencing the base table, in a query that includes a nested table and other joins
body: <p>I've distilled down a problem query to the following example, and I can't find anything on metalink indicating that this is a known bug, or expected behaviour.</p>
  
  <p>The following script is self contained so anyone could reproduce this, I'm using Oracle 11.2.0.3.0 enterprise 64-bit running on RHEL, queries being submitted via SQL Developer, the same results occur in SQL Plus.</p>
  
  <p>First : create the nested table type.</p>
  
  <pre><code>create type nested_type_test as table of varchar(32);
  </code></pre>
  
  <p>Second : create a table using the type as the nested type.</p>
  
  <pre><code>create table nested_table_test (
    uuid          varchar(32)
    , some_values nested_type_test
  )
  NESTED TABLE some_values STORE AS nested_some_values;
  </code></pre>
  
  <p>Third : create an arbitary table that we will use to create a join statement with.</p>
  
  <pre><code>create table join_table (
    uuid  varchar(32)
  );
  </code></pre>
  
  <p>Now for some simple SQL statements:</p>
  
  <pre><code>select *
  from nested_table_test ntt, table(some_Values) sv;
  
  select *
  from nested_table_test ntt, table(some_Values) sv
  where ntt.uuid = 'X';
  </code></pre>
  
  <p>Both work, I havn't inserted data but for the purposes of this bug / test we do not need to since the issue is a parse issue. Next statement, I add the join to the arbitary table I generated for this purposes.</p>
  
  <pre><code>select *
  from nested_table_test ntt, table(some_Values) sv
  inner join join_table jt on jt.uuid = ntt.uuid;
  </code></pre>
  
  <p>This now produces : <code>ORA-00904: "NTT"."UUID": invalid identifier</code> - yet I know that the field exists and could reference it in a where clause. Taking out the <code>TABLE(some_values)</code> clause like this,</p>
  
  <pre><code>select *
  from nested_table_test ntt
  inner join join_table jt on jt.uuid = ntt.uuid;
  </code></pre>
  
  <p>and the query works, so I know it is isolated to the existance of the nested table clause within the statement.</p>
  
  <p>If I switch to using a manual join instead of an ANSI join, it then parses and executes again.</p>
  
  <pre><code>select *
  from nested_table_test ntt, table(some_Values) sv, join_table jt
  where jt.uuid = ntt.uuid;
  </code></pre>
  
  <p>Alternatively, and even more hack-ish:</p>
  
  <pre><code>select *
  from nested_table_test ntt, table(some_Values) sv
  inner join join_table jt on 1=1
  where jt.uuid = ntt.uuid;
  </code></pre>
  
  <p>Also parses - so it is not the <code>ntt.uuid</code> itself that is the problem, but where it occurs within the statement that the parser seems to struggle with.</p>
  
  <p>Known bug, Unknown bug or expected behaviour?</p>
  
  <p>Edit : Using <code>CROSS JOIN table(some_values) sv</code> causes a seg fault and a trace file on the server whilst dumping the connection - that one for sure is a bug. It's also why I'm not in pure ANSI join syntax.</p>