FWIW I found the XMLTABLE approach slower too. Though marginal difference in number of latches:
SQL> begin
2 for c in (
3 select *
4 from t , xmltable(
5 'if (contains($X2,"|")) then ora:tokenize($X2,"\|") else $X2'
6 passing y as x2
7 columns x2 varchar2(4000) path '.'
8 )
9 where x2 is not null
10 ) loop
11 null;
12 end loop;
13 end;
14 /
PL/SQL procedure successfully completed.
SQL>
SQL> exec runstats_pkg.rs_middle;
PL/SQL procedure successfully completed.
SQL>
SQL> begin
2 for c in (
3 select x, substr( y||'|' , instr( y||'|' ,'|',1,column_value)+1,
4 instr(y||'|' ,'|',1,column_value+1) -
5 instr(y||'|' ,'|',1,column_value) - 1) new_val
6 from t , table( cast(multiset(select level
7 from dual
8 connect by level <= length(y) -
9 length(replace(y,'|')) ) as sys.odcinumberlist)) t2
10 ) loop
11 null;
12 end loop;
13 end;
14 /
PL/SQL procedure successfully completed.
SQL>
SQL> exec runstats_pkg.rs_stop(1000);
Run1 ran in 2426 hsecs
Run2 ran in 1312 hsecs
run 1 ran in 184.91% of the time
Name Run1 Run2 Diff
STAT...CPU used by this sessio 2,212 1,193 -1,019
STAT...recursive cpu usage 2,124 1,104 -1,020
STAT...CPU used when call star 2,216 1,192 -1,024
STAT...Elapsed Time 2,427 1,313 -1,114
STAT...DB time 2,429 1,307 -1,122
STAT...no work - consistent re 28,135 27,007 -1,128
STAT...consistent gets pin 28,169 27,034 -1,135
STAT...consistent gets pin (fa 28,169 27,034 -1,135
STAT...recursive calls 27,342 26,050 -1,292
STAT...consistent gets from ca 29,181 27,070 -2,111
STAT...session logical reads 29,238 27,127 -2,111
STAT...consistent gets 29,181 27,070 -2,111
LATCH.cache buffers chains 57,604 54,974 -2,630
STAT...table scan disk non-IMC 2,315,460 2,234,017 -81,443
STAT...table scan rows gotten 2,320,162 2,238,719 -81,443
STAT...sorts (rows) 2 100,000 99,998
STAT...workarea executions - o 3 100,002 99,999
STAT...sorts (memory) 1 100,001 100,000
STAT...session uga memory -65,488 65,488 130,976
STAT...session pga memory -327,680 524,288 851,968
STAT...logical read bytes from 239,517,696 222,224,384 -17,293,312
Run1 latches total versus runs -- difference and pct
Run1 Run2 Diff Pct
62,094 59,582 -2,512 104.22%