Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Splitting comma seperated string without using Regular expressions

564035Sep 21 2012 — edited Jun 17 2013
Hi,
I have a string that contains comma seperated values 'a,b,c,d,e'.

Is there a way to split these values without using regular expressions?

I know it can be done using regular expressions as follows:
WITH t AS
( SELECT 'a,b,c,d,e' AS txt FROM dual
)
SELECT CAST(REGEXP_SUBSTR (txt, '[^,]+', 1, level) AS CHAR(12))
FROM t
CONNECT BY level <= LENGTH(regexp_replace(txt,'[^,]*'))+1;

But the problem is that the software I will embed it into doesn't like the [^,] signs and removes them, and I cannot change this behaviour or escape it as a special character.


Thanks

AK
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 15 2013
Added on Sep 21 2012
21 comments
13,548 views