title: Is it possible to create dynamic varchar2 variable?
body: <p>I have a function in PLSQL, that operates with strings and return VARCHAR2 type.</p>
  
  <p>One of the variables in this function is</p>
  
  <pre><code>result_key     VARCHAR2 (4000) := '';
  </code></pre>
  
  <p>When it work with a big amount of data I get <code>ORA-06502: PL/SQL: numeric or value error: character string buffer too small</code> error.</p>
  
  <p>Seems like I have to extend my <code>result_key</code> variable. The only solution I see is to declare <code>result_key</code> as</p>
  
  <pre><code>result_key     VARCHAR2 (8000) := '';
  </code></pre>
  
  <p>I want to know if I can do it without declaring fixed size of <code>result_key</code>.</p>