现在新涉及一个项目,需要对汉字进行匹配。
例如:
“北京航空航天大学”和
“北京航天”匹配原始数据为
id content
1 北京航空航天大学
2 北京航天查询出表中想上面所有类似的数据
例如:
“北京航空航天大学”和
“北京航天”匹配原始数据为
id content
1 北京航空航天大学
2 北京航天查询出表中想上面所有类似的数据
解决方案 »
- 同一用户,同一条sql语句,查询出不同结果?
- select * 自动生成字段
- 写了个触发器,oracle报错:cannot create tirigers on objects owned by sys
- 一个简单的过程
- oracle转sql2000问题
- 请问一个概念性基础的问题
- 高手请进,帮我看看这个程序,该如何优化!!谢谢
- 怎样把序列号清零?
- select * from table where time=SYS.time ? 对不对? 如何得到当天时间输入的记录?
- oracle 安装后提示ora-01031:insufficint privileges
- Oracle sql语句报错,高手请看
- 请教一条Oralle的sql语句怎么写
表:table
字段:id,content
内容:
1 赛爱电解专卖店
2 赛爱电解生成器专卖店
3 赛爱离子水机店
4 赛安服饰安服饰饰大楼
5 北京航空航天大学
6 北京航天
7 佐登妮丝美容化妆品有限公司
8 越秀区佐登妮丝流花美容院
9 佐登妮丝国际美容连锁机构
10 佐登妮丝有限公司
11 佐登妮丝广州美容化妆品有限公司
查询结果要为通过“佐登妮丝”,“赛爱电解”等等。这样匹配
显示出查询结果
select * from table where context like '*检索字段*';
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;
请联系我:[email protected]