title: Oracle - Number to varchar
body: <p>I have a table containing a column of type Number</p>
  
  <pre><code>create table tmp (
      /*other fields*/
      some_field Number
  )
  </code></pre>
  
  <p>and in a PL SQL script, I want to convert that field to a varchar. However, i don't know its length, so I get an exception</p>
  
  <blockquote>
    <p>Exception message is ORA-06502:
    PL/SQL: numeric or value error:
    character string buffer too small</p>
  </blockquote>
  
  <pre><code>v_some_field varchar(21);
  /*...*/
  v_some_field := TO_CHAR(some_field,'999999999999999999999');
  </code></pre>
  
  <p>How should i declare the v_some_field buffer? Setting it to varchar(32767) seems quite brute,  is there any alternative?</p>