SELECT ticket_customer_1,sector_ticket,
       LTRIM(MAX(SYS_CONNECT_BY_PATH(sector_class,'/'))
       KEEP (DENSE_RANK LAST ORDER BY curr),'/') AS elements
FROM   (SELECT ticket_customer_1,sector_ticket,
               sector_class,
               ROW_NUMBER() OVER (PARTITION BY sector_ticket ORDER BY secator_class) AS curr,
               ROW_NUMBER() OVER (PARTITION BY sector_ticket ORDER BY sector_class) -1 AS prev
        FROM   ke019t3.id_ticket_sectors ,ke019t3.ticket_view_t3  where sector_ticket=ticket_number
        and ticket_date between '01-JAN-2020' and sysdate and ticket_customer_1 in ('NU0001-UN','NU0002-UN','NU0004-UN','NU0005-UN','NU0020-UN','NU0079-UN','NU0093-UN','NU0100-UN')
        and SECTOR_REFUND_STATUS='S')
GROUP BY ticket_customer_1,sector_ticket
CONNECT BY prev = PRIOR curr AND sector_ticket = PRIOR sector_ticket
START WITH curr = 1

