Converting a comma separated String to a tabular list

By Ammar Sajdi      August 4th


I found out about the DBMS_UTILITY.comma_to_table just recently. I though it is a very nice procedure and helps solves many parsing issues.  Here we have a string containing the x9 x1 x9 x4 separated by commas and will be arranged in a table fashion in an array called t_tab

     l_list varchar2(1000) := 'x9,x1,x9,x4';        --   The string containing the elements to be converted to a tabular format
     l_tablen binary_integer;                         --  the number of elements returned by the comma-to-table procedure
     l_tab dbms_utility.uncl_array;                --  The array with the converted info
     dbms_utility.comma_to_table(l_list, l_tablen, l_tab);   -- Conversion process
     for i in 1 .. l_tablen  loop                                         -- manipulating each element
         dbms_output.put_line('=' || l_tab(i));                    -- printing it out 
     end loop;

The result is