title: Oracle number and varchar join
body: <p>I have a query that joins two tables.  One table has a column that is of type varchar, and the other table has type of number.  I have executed my query on 3 oracle databases, and am seeing some strange results I hope can be explained.  On two of the databases something like the following works.</p>
  
  <pre><code>select a.col1, b.somecol 
  from tableA a inner join tableB b on b.col2=a.col1;
  </code></pre>
  
  <p>In this query tableA.col1 is of type number and tableB.col2 is of type varchar.  This works fine in two of the databases but not in the third.  In the third I get (ORA-01722) error.  In the third I need to do something like...</p>
  
  <pre><code>select a.col1, b.somecol 
  from tableA a inner join tableB b on b.col2=to_char(a.col1);
  </code></pre>
  
  <p>This works in all the databases.  The question I have is why?  The above is a simplified query, and the real query is a little more complex and retrieves a lot of data, hence the first version is much faster.  If I could get that to work in all environments it would be great.  </p>
  
  <p>Does anyone know why this may work in some oracle databases and not others without the cast on the datatype?  Is there a global setting that enables such behavior?</p>