参见英文答案 >
How to remove duplicates from space separated list by Oracle regexp_replace? 3个
> How to remove duplicates from comma separated list by regexp_replace in Oracle?2个
我有这个字符串
> How to remove duplicates from comma separated list by regexp_replace in Oracle?2个
我有这个字符串
ABCD1234,XYZ,ABCD1234,ABCD1234C,abc,abcX,1234U,1234
我想要,但我不想要重复值
ABCD1234,1234,
我正在使用下面的正则表达式
select regexp_replace ( 'ABCD1234,1234','([^,]+)(,\1)+','\1' ) test from dual;
解决方法
按照第
http://www.dba-oracle.com/t_extract_comma_delimited_strings_oracle_sql.html条,试试这个:
select distinct str from (select regexp_substr ('ABCD1234,'[^,]+',1,rownum) str from dual connect by level <= regexp_count ('ABCD1234,]+')) v;