And here's one for the era. How can SQL?

Entry: Channel 541862356

Table has 2 columns:
SNO                             SLENGTH
----------------               -------------
5418                                4
54186                               5
54321                               5
Output should be 54186.

We have no other input. that is, get the closest match to the input string.

How to do this?

Edited by: user12240205 may 3, 2012 22:51
WITH t AS
     (SELECT 5418 sno, 4 cnt
        FROM DUAL
      UNION
      SELECT 54186, 5
        FROM DUAL
      UNION
      SELECT 54321, 5
        FROM DUAL)
SELECT sno, utl_match.edit_distance(sno,541862356) dist
  FROM t
  where utl_match.edit_distance(sno,541862356) =(select min(utl_match.edit_distance(sno,541862356)) from t);

Tags: Database

Similar Questions

Maybe you are looking for