I need to write script in Oracle to split strings 'BP/593/00294' and 'NC//12345' by / character in a query to have values in separate columns.
I was thinking something like:
select regexp_substr(mystr, '[^/]+') as col1,
regexp_substr(c.usertext21,'[^/]+',1,2) as col2
from mytable
but in col2 I loose empty string value from second string. I need to keep every value from both strings. This should be the result:
<table>
<th>col1</th>
<th>col2</th>
<th>col3</th>
<tr>
<td>BP</td>
<td>593</td>
<td>00294</td>
</tr>
<tr>
<td>NC</td>
<td></td>
<td>12345</td>
</tr>
</table>
Any help would be appreciated. Thanks
