Search code examples
oracle-databaseoracle11gsoundex

Soundex with numbers as String parameter


Do you know some explanation why SOUNDEX does not work with NUMBERS as string?

These queries works fine:

select 1 from dual
where soundex('for you') = soundex('for u')
;

select 1 from dual
where soundex('for you') = soundex('for you')
;

But this one doesn´t:

select 1 from dual
where soundex('6000') = soundex('6000')
;
select 1 from dual
where soundex('5') = soundex('5')
;

I was reading documentation http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions167.htm#SQLRF06109 but does not mention some useful about it.


Solution

  • The soundex algorithm was specifically developed to match names based on how they sound rather than the exact spelling used. It works basically by mapping strings of letters to short strings containing primarily their consonant sounds. Numeric digits will be completely ignored (e.g. stripped from the string) by the soundex algorithm.

    You will need a different strategy for doing approximate matching on strings of digits.