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!

Regular expression to remove duplicates inside a string

977650Nov 8 2017 — edited Nov 9 2017

Hi experts,

I have a field with data  as shown below

WITH T AS
(SELECT 'TEXT1|| TEXT1|| TEXT2|| TEXT2|| TEXT1|| TEXT2|| TEXT3' TEST FROM DUAL)
SELECT * FROM T;

As you can see there are duplicate string with double pipe delimiter (||). I want to remove the Duplicates and instead of

TEXT1|| TEXT1|| TEXT2|| TEXT2|| TEXT1|| TEXT2|| TEXT3

I want to see

TEXT1|| TEXT2|| TEXT3

How can i achieve this using regexp?


I do not want to create a function or write complex heircharchical sqls so i am opting for regexp.

Thanks in advance.

This post has been answered by _jum on Nov 9 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 7 2017
Added on Nov 8 2017
11 comments
1,891 views