title: PL/SQL How to convert a record to an assoc array
body: <p>I am trying to fetch data from a table(employee) with cursor and save to asso. array. However, fetching data with cursor to a record is more straight-forward and it is troublesome to convert a record to an assoc array(arr). Code below is what I am trying to fetch data to a assoc array and improvement is needed. Or any approaches other than cursor? Thank you.</p>
  
  <pre><code>DECLARE
  TYPE AssoArray IS TABLE OF varchar2(30) INDEX BY varchar2(30);
  arr AssoArray;
  table_rec employee%rowtype;
  CURSOR cur IS
      SELECT *  FROM employee;
  BEGIN
      OPEN cur;
      LOOP
          FETCH cur into table_rec;
          EXIT WHEN cur%notfound;
          -- how to improve the code in the section below,
          arr('col1') := table_rec.col1;
          arr('col2') := table_rec.col2;
          arr('col3') := table_rec.col3;
                      ...
          arr('col50') := table_rec.col50;
          -- end of section
          -- do sth
      END LOOP;
  END;
  </code></pre>