In the Oracle database, the SOUNDEX function returns the voice representation of the string parameter, which is useful for spelling different words, but has the same pronunciation as some others.
Syntax of the SOUNDEX function:
SOUNDEX (string)
Algorithm for Computing speech:
1. Keep the first letter of the string, but delete a, e, h, I, o, w, and y.
2. Assign the numbers in the following table to the corresponding letters.
(1) 1: B, f, p, v
(2) 2: c, g, k, q, s, x, z
(3) 3: d, t
(4) 4: l
(5) 5: m, n
(6) 6: r
3. if the string contains two or more letters with the same number (for example, B and f), or only h or w, the other strings are deleted, retain only one
4. Only the first four bytes are returned, which is not filled with 0.
Example:
Soundex ('two'), soundex ('too'), soundex ('to'), and their results are T000
Soundex ('Cap '), soundex ('cup'), all of their results are C100
Soundex ('house') and soundex ('horse'). Their results are H200 and H620 respectively.