This question already has an answer here:
I have this string
ABCD1234, XYZ, ABCD1234, ABCD1234C, ABCD1234, abc, abcX, 1234U, 1234
and I want, but I don't want duplicates values
ABCD1234, XYZ, ABCD1234C, abc, abcX, 1234U, 1234,
I'm using below regex
select regexp_replace (
'ABCD1234, XYZ, ABCD1234, ABCD1234C, ABCD1234, abc, abcX, 1234U, 1234',
'([^,]+)(,\1)+', '\1'
) test
from dual;
Here's one option:
Try this, as per article http://www.dba-oracle.com/t_extract_comma_delimited_strings_oracle_sql.html:
Fiddle: http://sqlfiddle.com/#!4/c858d/5