DB2 use C and C++ host variable arrays
<p>I'm attempting to insert multiple rows into a DB2 database using c / c++ code like this:</p>

<pre><code>EXEX SQL BEGIN DECLARE SECTION;
     char inputArrayChar1 [3][10];
     char inputArrayChar2 [3][10];
     char inputArrayChar3 [3][10];
EXEX SQL END DECLARE SECTION;

for(int i = 0 ; i &lt; 3 ; i++)
{
  sprintf(inputArrayChar1[i] , "column1Data%d" , i + 1);
  sprintf(inputArrayChar2[i] , "column2Data%d" , i + 1);
  sprintf(inputArrayChar3[i] , "column3Data%d" , i + 1);
}

EXEC SQL INSERT INTO TABLETEST (COLUMN1 , COLUMN2 , COLUMN3)
             VALUES(:inputArrayChar1 , :inputArrayChar2 ,inputArrayChar3);
</code></pre>

<p>run process DB result : only 1 row data , other 2 rows data not insert to DB.</p>

<p>Can anyone explain what could account for this?</p>

<p>I have inquiries to 1 case , need add ROWS syntax　code like this:</p>

<pre><code>EXEC SQL INSERT INTO TABLETEST (COLUMN1 , COLUMN2 , COLUMN3)
      3 ROWS VALUES(:inputArrayChar1 , :inputArrayChar2 ,inputArrayChar3);
</code></pre>

<p>but use this syntax , Compiler issue is SQL0104N message "An unexpected token '3 ROWS' ....."</p>

<p>Can anyone explain what could account for this? Or I need add  Environment variable to db ? or add Environment variable to Compiler Environment ?</p>

<p>thanks.</p>

<p>　</p>