SELECT RESULT, RESULT FROM (
SELECT LISTAGG(DATA,',') WITHIN GROUP (ORDER BY DATA)RESULT FROM (
SELECT REGEXP_SUBSTR ('APPLE,BANANA','[^' || ',' || ']+',1,LEVEL)DATA FROM DUAL
CONNECT BY LEVEL <= LENGTH ('APPLE,BANANA') - LENGTH (REPLACE ('APPLE,BANANA', ',')) + 1
MINUS
SELECT REGEXP_SUBSTR ('BANANA,ORANGE','[^' || ',' || ']+',1,LEVEL)DATA FROM DUAL
CONNECT BY LEVEL <= LENGTH ('BANANA,ORANGE') - LENGTH (REPLACE ('BANANA,ORANGE', ',')) + 1))
RESULT RESULT
------------------------------ ------------------------------
APPLE APPLE