This content has been marked as final. Show 4 replies
If you have only one string:
This works in Orcle 10.1 and up.
WITH sample_data AS ( SELECT '98,78,67,68,34,90' AS str FROM dual ) SELECT LEVEL AS N , REGEXP_SUBSTR ( str , '[^,]+' , 1 , LEVEL ) AS sub_str FROM sample_data CONNECT BY LEVEL <= 1 + LENGTH (str) - LENGTH (REPLACE (str, ',')) ;
Starting in Oracle 11.1, you can use REGEXP_COUNT to find how many ','s are in str.