Oracle Query to find distinct comma separated values from given String :
SELECT Listagg(word, ',')
within GROUP (ORDER BY NULL) output_string
FROM (SELECT DISTINCT Regexp_substr(val, '[^,]+', 1, column_value) word
FROM (SELECT :p_comma_seperated_str val
FROM dual),
TABLE(Cast(MULTISET(SELECT LEVEL
FROM dual
CONNECT BY LEVEL <= Regexp_count(val, ',') + 1) AS
sys.ODCINUMBERLIST)));
No comments:
Post a Comment