title: Remove duplicates from associative array with multiple columns in PL/SQL
body: <p>I have seen several great examples of removing duplicates in an Oracle associative array using <code>MULTISET UNION DISTINCT</code> and <code>SET</code>.  It works great when there is only a single column.
  I have an associative array based on a <code>RECORD</code> type which contains 3 columns.
  Is it possible to use the methods mentioned above?</p>
  
  <pre><code>DECLARE
    TYPE rec_type IS RECORD(
       column1 VARCHAR2(5)
      ,column2 VARCHAR2(5));
    TYPE my_aa IS TABLE OF rec_type;
    p_tbl my_aa := my_aa();
    q_tbl my_aa := my_aa();
  BEGIN
    p_tbl.extend(4);
    p_tbl(1).column1 := 'A1';
    p_tbl(1).column2 := 'a';
    --
    p_tbl(2).column1 := 'A1';
    p_tbl(2).column2 := 'b';
    --
    p_tbl(3).column1 := 'A1'; -- Dup 
    p_tbl(3).column2 := 'a'; -- Dup
    --
    p_tbl(4).column1 := 'A1';
    p_tbl(4).column2 := 'c';
    --
    dbms_output.put_line('-- First output contains duplicated');
    --
    FOR a IN p_tbl.first .. p_tbl.last LOOP
      dbms_output.put_line(a || ' = ' || p_tbl(a).column1 || ' / ' || p_tbl(a).column2);
    END LOOP;
    --
    --
    q_tbl := p_tbl MULTISET UNION DISTINCT p_tbl;
    --
    --
    dbms_output.new_line;
    dbms_output.put_line('-- Duplicates have been removad');
    FOR a IN q_tbl.first .. q_tbl.last LOOP
      dbms_output.put_line(a || ' = ' || q_tbl(a).column1|| ' / '||q_tbl(a).column2);
    END LOOP;
  END;
  </code></pre>