SQL:
SELECT CASE
WHEN listagg(DISTINCT t, ',') within GROUP(ORDER BY LENGTH(t) DESC) LIKE 'XXX%' THEN
'XXX'
ELSE
'YY'
END my_result
FROM (SELECT 'XXX,YY,XXX,YY' AS t FROM dual);
This gives the error "PL/SQL Beautifier could not parse text".
It works fine with the same code but the expression between WHEN and LIKE is framed in parentheses:
SQL:
SELECT CASE
WHEN (listagg(DISTINCT t, ',') within GROUP(ORDER BY LENGTH(t) DESC)) LIKE 'XXX%' THEN
'XXX'
ELSE
'YY'
END my_result
FROM (SELECT 'XXX,YY,XXX,YY' AS t FROM dual);