title: Entity Framework 6 - ORA-00932 while joining with ToString
body: <p>I'm testing out <strong>Entity Framework 6.2</strong> with an oracle database but facing issues while trying to join on multiple conditions with convertion.  </p>
  
  <p>I need to match <code>TABLE2_ID (NUMBER)</code> with <code>TABLE2.ID (VARCHAR2)</code> which are different value types.
  The problem is that the <code>ToString()</code> method translates into <code>TO_NCLOB</code> instead of <code>TO_NCHAR</code> which would work.</p>
  
  <pre><code>var query = from table1 in context.TABLE1
              join table2 in context.TABLE2 on table1.TABLE2_ID.ToString() equals table2.ID
              select  new
              {
                  table1.NAME,
                  table2.TEXT
              };
  </code></pre>
  
  <p>The generated SQL looks as following:</p>
  
  <pre><code>SELECT 
  1 AS "C1", 
  "Extent1"."NAME" AS "NAME", 
  "Extent2"."TEXT" AS "TEXT"
  FROM  "USER"."TABLE1" "Extent1"
  INNER JOIN "USER"."TABLE2" "Extent2" ON 
    (CASE WHEN ("Extent1"."TABLE2_ID" IS NULL) THEN N'' 
  
     // At this point I need TO_NCHAR
     ELSE TO_NCLOB("Extent1"."TABLE2_ID") END) = "Extent2"."ID"
  </code></pre>
  
  <p>This results in:</p>
  
  <blockquote>
    <p>ORA-00932: inconsistent datatypes: expected NCHAR got NCLOB</p>
  </blockquote>
  
  <p>I know there are many questions with almost the same exception but only with different use cases, so please have a look how I can solve this problem.<br>
  For e.g. is there a way to override the <code>ToString()</code> SQL translation?</p>
  
  <p><strong>MAIN PROBLEM:</strong> LINQ to SQL <code>.ToString()</code> converts into <code>TO_NCLOB</code> but I need <code>TO_NCHAR</code> or another solution.</p>
  
  <p>I use <strong>Visual Studio 2017</strong> with <strong>Oracle Developer Tools for VS2017 12.2.0.11</strong></p>