How can I use jaro-winkler to find the closest value in a table?

前端 未结 3 1510
臣服心动
臣服心动 2021-01-22 09:51

I have an implementation of the jaro-winkler algorithm in my database. I did not write this function. The function compares two values and gives the probability of match.

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-22 10:05

    DECLARE
      CURSOR citynames IS
        SELECT city FROM table_loc_master where statecode = 'PQ';
      CURSOR leasecity IS
        SELECT city FROM table_loc where State = 'PQ'
        MINUS
        SELECT to_char(city) city FROM table_loc_master where statecode = 'PQ';
      xProb NUMBER(10,8);
    BEGIN
      FOR x_rec IN leasecity
      LOOP
          FOR y_rec IN citynames
          LOOP
                xProb := jwrun(x_rec.city,y_rec.city,length(y_rec.city));
                If xProb > 0.97 Then
                   DBMS_OUTPUT.PUT_LINE('Source : ' || x_rec.city || ' Target: ' || y_rec.city );
                End if;
          END LOOP;
      END LOOP;
    END;
    

提交回复
热议问题