SQL Reference

DIFFERENCE

>>-DIFFERENCE--(--expression--,--expression--)-----------------><
 

The schema is SYSFUN.

Returns a value from 0 to 4 representing the difference between the sounds of two strings based on applying the SOUNDEX function to the strings. A value of 4 is the best possible sound match.

The arguments can be character strings that are either CHAR or VARCHAR up to 4 000 bytes.

The result of the function is INTEGER. The result can be null; if the argument is null, the result is the null value.

Example:

VALUES (DIFFERENCE('CONSTRAINT','CONSTANT'),SOUNDEX('CONSTRAINT'),
        SOUNDEX('CONSTANT')),
        (DIFFERENCE('CONSTRAINT','CONTRITE'),SOUNDEX('CONSTRAINT'),
        SOUNDEX('CONTRITE'))

This example returns the following.

 1           2    3   
 ----------- ---- ----
           4 C523 C523
           2 C523 C536

In the first row, the words have the same result from SOUNDEX while in the second row the words have only some similarity.


[ Top of Page | Previous Page | Next Page ]