If there are multiple columns - then this also works -
select REGEXP_SUBSTR (jango,'^[^#]*') as f1, REGEXP_SUBSTR(REGEXP_REPLACE(jango,'^([^#]*#){1}', ''),'^[^#]*') as f2, REGEXP_REPLACE(jango,'^([^#]*#){2}', '') as f3 from ( Select decode(level, 1, 'foo#koo#joo', 2, 'bar#loo#too' , 3, 'more stuff#doo#dingo') as jango from dual connect by level <= 20 )
Here's how it works. The internal query is the same as above. I added some columns using # - we need to make sure that it is not part of the regular expression family, and we need to avoid it.
Select decode(level, 1, 'foo#koo#joo', 2, 'bar#loo#too' , 3, 'more stuff#doo#dingo') as jango from dual connect by level <= 20
Gives the following -
Jango ------------------- foo#koo#joo bar#loo#too more stuff#doo#dingo
Now the next fragment is selected from the output column - "jango", anything up to #
REGEXP_SUBSTR (jango,'^[^#]*') as f1, O/p --> foo
for the second column, we delete the contents of the 1st column, followed by #
REGEXP_REPLACE(jango,'^([^#]*#){1}', '') we get --> koo#joo
Now the first step is to get the first field.
for more fields {1} can be increased.