我在 Oracle DB 中有两列要比较,如果字符串不同,我想在其他列中显示差异。我知道我想念一些东西。例如:
SELECT A.CD_KEY01,
A.TEXT_01,
B.TEXT_02,
UTL_MATCH.edit_distance_similarity(A.TEXT_01, B.TEXT_02) AS distance_similarity
FROM TB_TABLE_01 A
JOIN TB_TABLE_02 B
ON A.CD_KEY01 = B.CD_KEY02
我得到的示例输出:
CD_KEY01 | TEXT_01 | TEXT_02 | DISTANCE_SIMILARITY
111 | Superman is good | Superman is good | 100
222 | Superman is bad | Superman is bad | 100
333 | Superman is handsome | Hulk is ugly | 33
444 | Superman is awful | Batman is awful | 90
我需要的示例输出:
CD_KEY01 | TEXT_01 | TEXT_02 | DISTANCE_SIMILARITY | DIFF_01 | DIFF_02
111 | Superman is good | Superman is good | 100 | NULL | NULL
222 | Superman is bad | Superman is bad | 100 | NULL | NULL
333 | Superman is handsome | Hulk is ugly | 33 | Hulk | ugly
444 | Superman is awful | Batman is awful | 90 | Batman | NULL