title: ORA-01722: invalid number in to_number
body: <p>I’m trying to connect data from two tables by invoice number,</p>
  
  <pre><code>LOC         NOT NULL VARCHAR2(40)
  INV_ORG            NUMBER
  </code></pre>
  
  <p>Like this it works fine:</p>
  
  <pre><code>SELECT     oh.inv_org,e.loc
  FROM       headers oh, sites e
  WHERE
  AND e.location = TO_CHAR(oh.inv_org);
  </code></pre>
  
  <p>But when I try to convert char to number I get 
  ORA-01722: invalid number    </p>
  
  <pre><code>SELECT     oh.inv_org, e.loc
  FROM       headers oh, sites e
  WHERE
  AND to_number(e.loc) = oh.inv_org;
  </code></pre>
  
  <blockquote>
    <p>Error report </p>
    
    <p>ORA-01722: invalid number</p>
  </blockquote>
  
  <p>I don't know why because in select, conversion works also fine</p>
  
  <pre><code>INV_ORG  110992
  LOC  110992
  OH.INV_ORG-TO_NUMBER(E.LOC) 0
  </code></pre>