4 Replies Latest reply on Apr 5, 2018 10:01 AM by martin.jesterhoudt

    Insert in local temporary table in while loop fails

    martin.jesterhoudt

      Hi,

       

      I'm trying to fill a temporary table within a while loop. This doesn't work. What am I doing wrong?

       

      Within a procedure I have this kind of code:

       

      CREATE LOCAL TEMPORARY TABLE excel_temp (LABEL STRING, WAARDE STRING);

      WHILE (VARIABLES.i < 4)

      BEGIN

        INSERT INTO #excel_temp (#excel_temp.label, #excel_temp.waarde) VALUES ('A', 'B'); 

        VARIABLES.i = (VARIABLES.i + 1);

      END

      SELECT #excel_temp.label AS c1, #excel_temp.waarde AS v1 FROM #excel_temp;

       

      The same insert outside the loop works fine.

       

      Regards

      Martin

      -- Teiid 11.1.1