I have a query pulling data and one of the columns is a list of remedy tickets. In my query, I'm using a regex to remove duplicates returned by the listagg.
select distinct rt.change_request_name,rt.change_request_number,rt.user_id,rt.full_name, rt.termination_date, RTRIM ( REGEXP_REPLACE ( (listagg(ica.ticket_number,', ') within group (ORDER BY ica.ticket_number) over (partition by ica.change_request_id)), '([^,]*)(,\1)+($|,)', '\1\3'),',') as Remedy_Ticket from remedy_ticket rt
When I run my query in SQL Developer the results return as expected with the duplicates removed.
When it is part of my job, the results still contain the duplicates.