title: How do I iterate through this table of multiple columns?
body: <p>I'm a newbie with collections in PL/SQL, and am trying to use <code>BULK COLLECT</code> and <code>FORALL</code> with a table of a record of <strong>multiple columns</strong>. How can I iterate through the loop?</p>
  
  <p>I tried different syntax options and they all failed. I couldn't find a reference online for <strong>multiple columns</strong> - I can only find examples with a <strong>single column</strong>.</p>
  
  <pre><code>--Here are my declarations. Note that there is more than one column in the record. 
  --The examples I could find online only use one column:
  type mytable_rec is record
  (
        mytable_col1 mytable.mytable_col1%type,
        mytable_col2 mytable.mytable_col2%type
  );
  
  type mytable_tab is table of mytable_rec;  
  
  l_mytable mytable_tab ;
  
  --I've already loaded my query into l_mytable using bulk collect. 
  --Skipping it for readability
  
  forall i in 1 .. l_mytable.count loop --The procedure won't compile 
                                        --because of this line
        update mytable set
               mytable.mytable_col1 = i.mytable_col1,
               mytable.mytable_col2 = i.mytable_col2
         where 1 = 1; --some condition goes here                            
  end loop;    
  </code></pre>
  
  <p>Trying the following won't work either:</p>
  
  <pre><code>forall i in l_mytable.first .. l_mytable.last loop --The procedure won't compile 
                                                     --because of this line
        update mytable set
               mytable.mytable_col1 = i.mytable_col1,
               mytable.mytable_col2 = i.mytable_col2
         where 1 = 1; --some condition goes here                            
  end loop;   
  </code></pre>
  
  <p>Thanks!</p>