SQL>
SQL> set echo on
SQL>
SQL> declare
2 type vcArray is table of varchar2(4000);
3
4 l_names vcArray := vcArray( 'emp,dept,bonus',
5 'a, b , c',
6 '"1", "6", "9"',
7 '"This is a long string","b",c');
8 l_tablen number;
9 l_tab dbms_utility.uncl_array;
10 begin
11 for i in 1 .. l_names.count
12 loop
13 dbms_output.put_line( ' ' || '[' || l_names(i) || ']' );
14 begin
15 dbms_utility.comma_to_table( l_names(i),l_tablen, l_tab );
16
17 for j in 1..l_tablen
18 loop
19 dbms_output.put_line( '[' || l_tab(j) || ']' );
20 end loop;
21 l_names(i) := null;
22 dbms_utility.table_to_comma( l_tab,l_tablen, l_names(i) );
23 dbms_output.put_line( l_names(i) );
24 exception
25 when others then dbms_output.put_line( sqlerrm );
26 end;
27 end loop;
28 end;
29 /
[emp,dept,bonus]
[emp]
[dept]
[bonus]
emp,dept,bonus
[a, b , c]
[a]
[ b ]
[ c]
a, b , c
["1", "6", "9"]
["1"]
[ "6"]
[ "9"]
"1", "6", "9"
["This is a long string","b",c]
["This is a long string"]
["b"]
[c]
"This is a long string","b",c
PL/SQL procedure successfully completed.
SQL>