上名字的soundex
試試這個使用listagg
和group by
:
with your_table (HumanName) as (
select 'Kamil' from dual union all
select 'Azer' from dual union all
select 'John' from dual union all
select 'Elmir' from dual union all
select 'Kamal' from dual union all
select 'Elmar' from dual union all
select 'Orxan' from dual union all
select 'Elnar' from dual
)
------ Test data setup ends here ------
select
listagg(humanname,',') within group (order by humanname) nameswhichlikes
from your_table
group by soundex(humanname)
having count(*) > 1;
產地:
+---------------------------+
| NAMESWHICHLIKES |
+---------------------------+
| Elmar,Elmir,Elnar |
+---------------------------+
| Kamal,Kamil |
+---------------------------+
重名的情況:
select
listagg(humanname,',') within group (order by humanname) nameswhichlikes
from (select distinct humanname from your_table)
group by soundex(humanname)
having count(*) > 1;
請編輯問題以闡明您需要的邏輯。因爲它是完全不清楚的 – Aleksej
你如何定義類似?由不同的字符數量?考慮大寫/小寫? ... – Aleksej
你說「卡米爾」類似於「卡邁勒」,「埃爾米爾」類似於「埃爾瑪」和「埃爾納爾」。爲什麼?您需要解釋所需結果背後的邏輯。 – Aleksej