Нечто подобное устранит дубликаты:
Демонстрация SQL
with temp as
(
select 1 Name, 'test1' Project, 'apple, apple, orange' Error from dual
union all
select 2, 'test2', 'apple, apple, apple, apple,' from dual
), split as (
select distinct
t.name, t.project,
trim(regexp_substr(t.error, '[^,]+', 1, levels.column_value)) as error
from
temp t,
table(cast(multiset(select level
from dual connect by level <= length (regexp_replace(t.error, '[^,]+')) + 1) as sys.OdciNumberList)) levels
)
SELECT Name, listagg(Error, ',') within group(order by 1) as result
FROM split
GROUP BY Name
ВЫХОД
Как видите, вы получаете NULL, потому что эта лишняя запятая ,