This is an awful, horrible way to store lists. But, Oracle has this amazing thing called regular expressions and they will allow you to do this. To get a refresher on them, try running this:
with t as (
select '((a,)|(c,)|(b,)){3}' as pat from dual
)
select pat, (case when regexp_like('a,b,c' ||',', pat) then 1 else 0 end)
from t;
This returns true -- leading to the conclusion that we can bastardize a string to turn it into a regular expression to get a match on elements in another string. For full equality, we want to do the comparison both ways.
So, here is some code that seems to solve your problem:
with t as (
select 'ABC,DEF,XYZ' as val1, 'ABC,XYZ,DEF' as val2 from dual union all
select 'ABC,DEF,XYZ', 'ABC,XYZ,LMN' from dual
)
select t.*,
(case when regexp_like(val1 || ',', pat2||'{'||val2_len||'}') and
regexp_like(val2 || ',', pat1||'{'||val1_len||'}')
then 1 else 0
end) as comp
from (select t.*,
replace('((' || replace(val1 || ',', ',', ',)|(')||'))', '|())', ')') as pat1,
replace('((' || replace(val2 || ',', ',', ',)|(')||'))', '|())', ')') as pat2,
length(val1) - length(replace(val1, ',', '')) + 1 as val1_len,
length(val2) - length(replace(val2, ',', '')) + 1 as val2_len
from t
) t ;
This might not work if you have repeating values in the list. But, I will repeat, using junction tables or nested tables is the right way to store this information. Not string-encoded lists.