Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / January 2008

Tip: Looking for answers? Try searching our database.

Any function can find out the similar numeric string?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shenanwei@gmail.com - 15 Jan 2008 16:21 GMT
I have 2 strings here which has 1 or 2 digits different because of
typo, like below
179705723    179705732

Any simple way I can make them similar.
soundex function is no use at all, it return every thing into Z000.

My idea is to compare them byte by byte, if only 2 bytes are
different, I will say it is same.
Thanks.
jefftyzzer - 15 Jan 2008 19:20 GMT
On Jan 15, 8:21 am, shenan...@gmail.com wrote:
> I have 2 strings here which has 1 or 2 digits different because of
> typo, like below
[quoted text clipped - 6 lines]
> different, I will say it is same.
> Thanks.

Sounds like you're looking for an edit-distance function, which
doesn't come with DB2 pre-built. Two well-known edit-distance
algorithms are Levenshtein distance and Smith-Waterman distance, and
it would not be difficult for you to build a DB2 UDF that implements
either one.

Have a look at these links:

http://en.wikipedia.org/wiki/Levenshtein_distance
http://en.wikipedia.org/wiki/Smith-Waterman_algorithm
http://www.merriampark.com/ld.htm

Regards,

--Jeff

Have a look at these sites
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.