ITPub博客

首页 > 数据库 > Oracle > ORACLE全文索引 快速入门+代码

ORACLE全文索引 快速入门+代码

原创 Oracle 作者:03shy 时间:2015-07-28 18:09:48 0 删除 编辑

 
--1.建立全文索引测试数据
 create table lxs as
 select * from dba_tables;
--删除测试数据 drop table lxs; 

--2.创建词法分析
BEGIN
  ctx_ddl.create_preference ('test_lexer', 'chinese_vgram_lexer');
end;
--删除词法分析  BEGIN ctx_ddl.drop_preference ('test_lexer'); end;

--3.创建全文索引
CREATE INDEX ind_lxs ON lxs(TABLE_NAME)  
 indextype is ctxsys.context parameters('lexer test_lexer'); 
--删除全文索引 drop index ind_lxs force ;

--4.测试全文索引能不能用
 select * from lxs where contains(TABLE_NAME,'s')>0 ;
 



--5.附录,可以看到创建一个全文索引,要创建以下4张表 
 select * from user_tables t where t.TABLE_NAME like '%$%'

--6.同步维护
exec ctx_ddl.sync_index('ind_lxs '); 
--7.优化
exec ctx_ddl.optimize_index('ind_lxs ','FULL'); 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29821588/viewspace-1754505/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-08-23

  • 博文量
    3
  • 访问量
    4716