Monday, March 22, 2021

Remove duplicates from a string separated by colon Oracle SQL using REGEXP


Remove duplicates from a string separated by colon or by any keyword



select distinct str from (
select regexp_substr('abc:xyz:abc:pqr:xyz','[^:]+',1,level) str from dual
connect by level <= regexp_count('abc:xyz:abc:pqr:xyz','[^:]+', 1)
);



No comments:

Post a Comment