title: Concatenate rows to column; ORA-06502: error
body: <p>I'm using below function to concatenate rows into a single columns.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION getconcat(in_c1 IN t1.c1%TYPE)
    RETURN VARCHAR2
  IS
    value_concat VARCHAR2(1000);
    BEGIN
      FOR cur_rec IN (SELECT c7
                      FROM t1
                      WHERE c1 = in_c1
                      ORDER BY c1, c2, c3, c4, c5)
      LOOP
        value_concat := value_concat || ',' || cur_rec.c7;        
      END LOOP;
  
      RETURN substr(LTRIM(value_concat, ','), 1, 400);
    END;
  </code></pre>
  
  <p>I'm calling this function within a master stored procedure as</p>
  
  <pre><code> SELECT
           C1,
           getconcat (C1) AS After_concat,
             ..............
           FROM T1 
           GROUP BY C1
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>ORA-06502: PL/SQL: numeric or value error: character string buffer too small<br>
    ORA-06512: at "xx.getconcat", line 14  ( line corresponding to it value_CONCAT := value_CONCAT || ',' || cur_rec.C7;) </p>
  </blockquote>