如何在oracle中2个逗号分隔的列之间查找不匹配的字符串
字符串1:Apple,Banana 字符串2:香蕉,橙色
我需要得到苹果
答案 0 :(得分:0)
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