PLSQL | SOUNDEX Function
The PLSQL SOUNDEX function is used for returning a phonetic representation of a string. The phonetic represents the way the string will sound. The PLSQL SOUNDEX function helps to compare words that are spelled differently, but sound alike in English.
The SOUNDEX function accepts one parameter input_string which can be of any of the datatypes CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The return value is the same datatype as char.
Syntax:
SOUNDEX( input_string )
Parameters Used:
input_string – It is used to specify the string whose phonetic representation you want to know.
Note:
- The value returned by the SOUNDEX function will always begin with the first letter of the input_string.
- The SOUNDEX function uses only the first 5 consonants to determine the NUMERIC portion of the return value, except if the first letter of string1 is a vowel.
- The SOUNDEX function is not a case-sensitive function.
Supported Versions of Oracle/PLSQL:
- Oracle 12c
- Oracle 11g
- Oracle 10g
- Oracle 9i
- Oracle 8i
Example-1:
DECLARE Test_String string(25) := 'geeksforgeeks'; BEGIN dbms_output.put_line(SOUNDEX(Test_String)); END;
Output:
G216
Example-2:
DECLARE Test_String string(25) := 'GEEKSFORGEEKS'; BEGIN dbms_output.put_line(SOUNDEX(Test_String)); END;
Output:
G216
Example-3:
DECLARE Test_String string(25) := 'Hello'; BEGIN dbms_output.put_line(SOUNDEX(Test_String)); END;
Output:
H400
Example-4:
DECLARE Test_String string(25) := 'Hello'; BEGIN dbms_output.put_line(SOUNDEX(Test_String)); END;
Output:
H400
Example-5:
DECLARE Test_String string(25) := 'Hello User'; BEGIN dbms_output.put_line(SOUNDEX(Test_String)); END;
Output:
H426
Recommended Posts:
- PLSQL | EXP Function
- PLSQL | LN Function
- PLSQL | TAN Function
- PLSQL | MOD Function
- PLSQL | COS Function
- PLSQL | CHR Function
- PLSQL | SIN Function
- PLSQL | LOG Function
- PLSQL | ABS Function
- PLSQL | LEAST Function
- PLSQL | ASCII Function
- PLSQL | INSTRB Function
- PLSQL | LENGTHB Function
- PLSQL | LENGTH4 Function
- PLSQL | COMPOSE Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : shubham_singh




