Document Type | Technical Information
Category | Utility
Document Number | TUTTI010
Overview
UTL_MATCH is a package that compares the similarity between two strings. This article provides guidance on some functions of UTL_MATCH and related patches.
Method
EDIT_DISTANCE
Compares two strings character by character, returning the number of differing characters as an integer value.
If either of the two strings is NULL, it returns -1.
Execution result) str1:Cunnigham , str2:Dunningham
DBMS_OUTPUT.PUT_LINE(UTL_MATCH.EDIT_DISTANCE('Cunnigham', 'Dunningham'));
โ Returns 2 because there is a difference of 2 characters.
EDIT_DISTANCE_SIMILARITY
Calculates the similarity between two strings as a percentage (0~100).
Shows how much the strings match based on the longer string, expressed as a percentage.
Execution result) str1:Cunnigham , str2:Dunningham
DBMS_OUTPUT.PUT_LINE(UTL_MATCH.EDIT_DISTANCE_SIMILARITY('Cunnigham', 'Dunningham'));
โ Returns 80 because, based on the longer string Dunningham, 2 out of 10 characters differ.
JARO_WINKLER
JARO_WINKLER is a function that calculates string similarity using the Jaro-Winkler algorithm.
NoteInternally, a more complex calculation method is applied. For detailed information, please refer to the Wikipedia article.