Oracle
 sql >> Database >  >> RDS >> Oracle

Come dividere una stringa in ordine con una stringa separata da virgole e (possibile) campi vuoti tra virgole

with test as (select 'value1;value2;;;value5;value6;' line from dual)
select nvl(regexp_substr (line, '([^;]*);', 1, rownum, null, 1), 'none') as split
from test
connect by level <= regexp_count (line, ';');

SPLIT                         
------------------------------
value1
value2
none
none
value5
value6

6 rows selected.