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!

Is it possible to do this using a Regular expression

Keith JamiesonOct 2 2007 — edited Oct 4 2007
Sample Data

Oracle 10.2.1

WITH BARCODE AS
(SELECT '1234|5678|1234|679134|1235|1234|679134|5678|1234|'
FROM DUAL)
SELECT * FROM BARCODE

I have some data as above. The '|' is a field separator and all the data is in one column. I need to get rid of the duplicates and was wondering if it was possible to do this with a regular expression. The above is sample which probably represents the worst situation I am likely to come across.
I can do this in PL/SQL but would like a SQL solution if possible.
I have a table which has data like this so what I'm really after is updating it
getting rid of any duplicate.

Comments

Paavo

Hi
Copy-pasting large snippets sounds like you could benefit of using editor instead?
It is possible to define editors like: emacs, vi, visual studio code.
For vcode:
--open terminal in vcode and use sqlcl and e file.sql and / commands and enjoy
define _EDITOR=code -w -r
rgrds Paavo
ps. have a look on @thatjeffsmith-oracle blogs e.g. http://www.thatjeffsmith.com/archive/2016/05/multiple-ways-to-edit-in-sqlcl/

AboMohammed

Thanks for your response.

I will definitely try it.

1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 1 2007
Added on Oct 2 2007
12 comments
1,423 views