SOUNDEX(x) is a string function that converts a character string x (string specification) to a format that is generated by the Soundex algorithm. Only expressions that produce an alphanumeric value are permitted as string specifications.
This representation can be used if the user does not know the exact spelling of the search term.
x |
Result of the SOUNDEX(x) function |
---|---|
SOUNDEX(x) |
The Soundex algorithm is used. The result is a value with the data type CHAR(4). |
x is a NULL value |
NULL value |
Example
The SOUNDS predicate is often applied to a column x. Since inversions cannot be used here, it is advisable for performance reasons to define an additional table column x1 with the data type CHAR(4), in which the result of SOUNDEX(x) is then inserted.
An SQL statement should then refer to the x1 column. In other words, use x1 = SOUNDEX(<string_literal>) instead of x SOUNDS LIKE <string_literal>.