Hi,
I am writing a query to split comma separated values of a column in row and get the unique values. I was able to split the comma separated values but unable to get the distinct values.
Is there a way to get distinct values in the below query:
with t as (select distinct(DECODED) as str from lkv where lku_key =1234)
select rtrim(ltrim(regexp_substr(str,'[^,]+',1,level))) as val
from t
connect by regexp_substr(str,'[^,]+',1,level) is not null;
Example data and table details are below along with how the output should look :
Table name : lkv
Column name : decoded

Could you please let me know, what is wrong in the above query.
Thanks in advance.