Removing duplicates in a string. [message #286996] |
Mon, 10 December 2007 16:51 |
Nirmala
Messages: 43 Registered: October 2004
|
Member |
|
|
Is there a function which can do the following. I have a string say
'cat,dog,rat,cat,cat,dog' and i want the output as 'cat,dog,rat,'. The duplicates
should be removed in the string. can someone suggest a efficient way of doing this.
select some_function('cat,dog,rat,cat,cat,dog') from dual;
>> 'cat,dog,rat,'
|
|
|
Re: Removing duplicates in a string. [message #287014 is a reply to message #286996] |
Mon, 10 December 2007 23:03 |
|
Michel Cadot
Messages: 68728 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
You can do it in SQL:
- string to rows
- distinct
- rows to string
(search for these expressions)
By the way, this is just an exercise as you MUST never have this in a real system.
1NF says an attribute/a value/a field must be atomic.
Regards
Michel
[Updated on: Mon, 10 December 2007 23:04] Report message to a moderator
|
|
|