I have this Query:
SELECT ROWNUM AS num_row,
REGEXP_SUBSTR(REPLACE('param1;param2;param3;;param5;;param7;;;param10;param11;param12;param13;param14;param15;',
';;',
'; ;'),
'[^;]+',
1,
level) AS par_value
FROM dual
CONNECT BY REGEXP_SUBSTR(REPLACE('param1;param2;param3;;param5;;param7;;;param10;param11;param12;param13;param14;param15;',
';;',
'; ;'),
'[^;]+',
1,
level) IS NOT NULL
with output:
1 param1
2 param2
3 param3
4
5 param5
6
7 param7
8
9 param10
10 param11
11 param12
12 param13
13 param14
14 param15
As you already saw (or not), between parameter 7 and 10 there are supposed to be two NULL parameters, but this query returns only one.
If i put one more semi-colon before 'param10' or change ';;param10' to '; ;param10' -> param10 is in row 10, but this is something i can not do.
It seems that a longer sequence of ';' oracle treat always like there is amount of semicolons -1 .
Does anyone have an idea how to fix it?