title: Oracle number format model maximum length
body: <p>I run into a peculiar limit in <code>X</code> <a href="http://docs.oracle.com/cd/E11882_01/server.112/e17118/sql_elements004.htm" rel="nofollow noreferrer">number format element</a> used in <code>to_number</code>and in <code>to_char</code> when I was <a href="https://stackoverflow.com/q/1227039/272735">converting hexadecimal numbers to decimal numbers</a>.</p>
  
  <p>It looks like number format model has maximum length of 63 characters but I can't find the limit mentioned in <a href="http://docs.oracle.com/cd/E11882_01/server.112/e17118/sql_elements004.htm" rel="nofollow noreferrer">the docs</a>. E.g. the maximum length of datetime format model is mentioned:</p>
  
  <blockquote>
    <p>The total length of a datetime format model cannot exceed 22 characters.</p>
  </blockquote>
  
  <p>With 63 <code>X</code>es:</p>
  
  <pre><code>SQL&gt; select to_number('A', rpad('X', 63, 'X')) from dual;
  
  TO_NUMBER('A',RPAD('X',63,'X'))
  -------------------------------
                               10
  </code></pre>
  
  <p>With 64 <code>X</code>es:</p>
  
  <pre><code>SQL&gt; select to_number('A', rpad('X', 64, 'X')) from dual;
  select to_number('A', rpad('X', 64, 'X')) from dual
                        *
  ERROR at line 1:
  ORA-01481: invalid number format model
  </code></pre>
  
  <p>I have only tried <code>X</code> format element as it is relevant for my current task.</p>
  
  <p><strong>The questions:</strong></p>
  
  <ol>
  <li>Is this a known number format model limitation that is just missing from documentation ?</li>
  <li>How do I convert a 64 (and longer) digit length hexadecimal number to a decimal number ?</li>
  </ol>