title: What is the result of Oracle TO_NCHAR?
body: <pre><code>SELECT COUNT(1) FROM DUAL WHERE TO_CHAR('666a') = 666
  </code></pre>
  
  <p>ORA-01722: INVALID NUMBER</p>
  
  <hr>
  
  <pre><code>SELECT COUNT(1) FROM DUAL WHERE TO_NCHAR('666a') = '666'
  </code></pre>
  
  <p>RESULT: 0</p>
  
  <hr>
  
  <pre><code>SELECT COUNT(1) FROM DUAL WHERE TO_NCHAR('666a') = '666a'
  </code></pre>
  
  <p>RESULT: 1</p>
  
  <hr>
  
  <pre><code>SELECT COUNT(1) FROM DUAL WHERE TO_NCHAR('666a') = 666
  </code></pre>
  
  <p>RESULT: 1</p>
  
  <hr>
  
  <p><strong>WHY</strong> the last SQL result is 1?</p>
  
  <p><strong>WHY</strong> the result of TO_NCHAR could be compared with a number?</p>
  
  <p>And it occurs in Oracle 11.2.0.3, but trigger ORA-01722 in Oracle 11.2.0.4</p>