title: String concatenation in DB2 Stored Procedures
body: <p>I have a DB2 stored procedures to get n number of sequence values and then combine them into a single comma delimited string and return it. The concat function in the stored procedure is not working as expected.</p>
  
  <pre><code>CREATE PROCEDURE REFWTX.GET_SEQ_VALUES (in numb integer, OUT SEQVALUES VARCHAR(10000))
  LANGUAGE SQL
  SPECIFIC GET_SEQ_VALUES
  BEGIN
  DECLARE SEQ_VAL Integer;
  DECLARE CUR_COUNT INTEGER;
  SET CUR_COUNT=1;
  WHILE (CUR_COUNT &lt;= numb) DO
  SELECT NEXTVAL FOR REFWTX.ACK_999_INTR_CTRL_NO_SEQ INTO SEQ_VAL FROM SYSIBM.SYSDUMMY1;
  set SEQVALUES = SEQVALUES|| ',' || CHAR(SEQ_VAL);
  SET CUR_COUNT=CUR_COUNT+1;
  END WHILE;
  return;
  END
  </code></pre>
  
  <p>The portion of the procedure:
      set SEQVALUES = SEQVALUES|| ',' || CHAR(SEQ_VAL);</p>
  
  <p>is not working as expected. How do I concatenate strings in stored procedures?</p>