现在新涉及一个项目,需要对汉字进行匹配。
例如:
“北京航空航天大学”和
“北京航天”匹配原始数据为
id    content
1     北京航空航天大学
2     北京航天查询出表中想上面所有类似的数据

解决方案 »

  1.   

    可能是没有描述清楚:
    表:table
    字段:id,content
    内容:
    1 赛爱电解专卖店
    2 赛爱电解生成器专卖店
    3 赛爱离子水机店
    4 赛安服饰安服饰饰大楼
    5       北京航空航天大学 
    6       北京航天
    7       佐登妮丝美容化妆品有限公司
    8       越秀区佐登妮丝流花美容院
    9       佐登妮丝国际美容连锁机构
    10      佐登妮丝有限公司
    11      佐登妮丝广州美容化妆品有限公司
    查询结果要为通过“佐登妮丝”,“赛爱电解”等等。这样匹配
    显示出查询结果
      

  2.   

    baidu内容:  oracle 全文检索
      

  3.   

    怎么这么复杂?LZ是不是想要
    select * from table  where context like '*检索字段*';
      

  4.   

    简单点考虑, LIKE就足够.
      

  5.   

    ORACLE全文检索技术可以提高速度.
      

  6.   

    谢谢各位了。根据业务需求是要求对每个字符进行匹配,以下是根据网上的改动下的函数,但效率很不理想,请高人给点意见
    create or replace function fun_match_cnt(p_str varchar2, p_str2 varchar2)
      return varchar2 is
      v_mother   varchar2(200);
      v_match    varchar2(20);
      v_lenm     number ;
      v_num      number := 0;
      v_cnt      number;
      v_mateched varchar2(200) := ' ';
    begin
      v_cnt    := 0;
      v_mother := p_str;
      
      v_lenm   := length(p_str2) ;
      for y in 1 .. v_lenm loop
        v_match := substr(p_str2, y , 1);
        
        select sign(instr(v_mother, v_match)) into v_num from dual;
        if v_num = 1 then
          v_mateched := trim(v_mateched || v_match);
          select substr(v_mother, 1, instr(v_mother, v_match) - 1) ||
                 substr(v_mother, instr(v_mother, v_match) + 1)
            into v_mother
            from dual;
          v_cnt := v_cnt + v_num;
          --v_cnt := v_cnt + fun_match_cnt(v_mother,v_match);
          v_mateched := trim(v_mateched ||
                             nvl(fun_match_cnt(v_mother, v_match), ' '));
        end if;
      end loop;
      ---dbms_output.put_line(v_cnt);
      -- return v_cnt;
      return trim(v_mateched);
    end;
      

  7.   

    楼主,我帮你完成好了,把数据给我,当天就可以给你结果,保证让你满意。
    请联系我:[email protected]