title: INSERT using LOOP with SELECT
body: <p>I am trying to insert the data from other table using INSERT/SELECT combo. I also need to insert increment with specific calculation. However, I can't figure out why it is not working.</p>
  
  <p>I have the table (temp_business_area) like this:</p>
  
  <pre><code> ----------
   | bname  |
   ----------
   | London |
   | Sydney |
   | Kiev   |
   ----------
  </code></pre>
  
  <p>I would like to have this in enum table:</p>
  
  <pre><code> -----------------------------------------------------------------
   | identifier    | language_id |   code | data   | company_limit |
   ----------------------------------------------------------------|
   | BUSINESS_UNIT |    0        |   100  | London | 126           |
   | BUSINESS_UNIT |    0        |   200  | Sydney | 126           |
   | BUSINESS_UNIT |    0        |   300  | Kiev   | 126           |
   -----------------------------------------------------------------
  </code></pre>
  
  <p>But what I get is this:</p>
  
  <pre><code>-----------------------------------------------------------------
   | identifier    | language_id |   code | data   | company_limit |
   ----------------------------------------------------------------|
   | BUSINESS_UNIT |    0        |   100  | London | 126           |
   | BUSINESS_UNIT |    0        |   100  | Sydney | 126           |
   | BUSINESS_UNIT |    0        |   100  | Kiev   | 126           |
   | BUSINESS_UNIT |    0        |   200  | London | 126           |
   | BUSINESS_UNIT |    0        |   200  | Sydney | 126           |
   | BUSINESS_UNIT |    0        |   200  | Kiev   | 126           |
   | BUSINESS_UNIT |    0        |   300  | London | 126           |
   | BUSINESS_UNIT |    0        |   300  | Sydney | 126           |
   | BUSINESS_UNIT |    0        |   300  | Kiev   | 126           |
   -----------------------------------------------------------------
  </code></pre>
  
  <p>And here is my loop. </p>
  
  <pre><code>BEGIN 
      FOR x IN 1 .. 3 LOOP
           INSERT INTO enum (identifier, language_id, code, data, company_limit)
           SELECT 'BUSINESS_UNIT', 0, x*100, bname, 126 FROM temp_business_area;
      END LOOP;
  END;
  </code></pre>
  
  <p>I can't figure out where am I making mistake. Help?</p>