--如果沒有這個使用者和角色,意味著你的資料庫建立時未安裝intermedia功能。
--你必須修改資料庫以安裝這項功能。
--用sys使用者為了使用者gzinfo分配許可權
grant
togzinfo;
grant
execute
onctx_ddl
togzinfo;
--回到gzinfo使用者
--建立測試表,clobtext欄位為需要索引的字段
create
table
inxtext (id
number(13
), clobtext clob);
--建立分詞,這裡用了chinese_vgram_lexer,分詞名為gzinfo_lexer
call ctx_ddl.create_preference (
'gzinfo_lexer',
'chinese_vgram_lexer');
--建立索引,索引名為inx_test (parameters 中需要以lexer開頭,替換時用replace)
create
index
inx_test
oninxtext (clobtext) indextype
isctxsys.context parameters (
'lexer info_lexer');
--建立記錄表
create
table
jobtest (id date, content
varchar2
(200
));
--建立同步儲存過程,ctx_ddl.sync_index('inx_test')為同步全文索引,同步表字段中的資訊
create
orreplace
procedure
proc_sync_index
isbegin
ctx_ddl.sync_index(
'inx_test');
insert
into
jobtest
values
(sysdate,
'同步任務於'||
sysdate||'
執行');end;
--建立同步優化儲存過程,ctx_ddl.optimize_index('inx_test','full')為優化全文索引
code
declare
x number
;begin
sys.dbms_job.submit
(job
=>
x ,what
=>
'proc_sync_optimize;
',next_date
=>
sysdate
,interval
=>
'trunc(sysdate + 1) + 1/(24)');
end;
ORACLE 全文索引
6 全文索引查詢語句contains select count from tablename t where contains t.name,農業銀行 公司 0 select from tablename t where contains t.name,農業 安徽 中 部 0 select from...
Oracle全文索引
zt 步驟三 設定詞法分析器 lexer oracle實現全文檢索,其機制其實很簡單。即通過oracle專利的詞法分析器 lexer 將文章中所有的表意單元 oracle 稱為 term 找出來,記錄在一組 以dr 開頭的表中,同時記下該term出現的位置 次數 hash 值等資訊。檢索時,orac...
oracle全文索引(全文檢索)的介紹,使用和創
全文索引 背景介紹 很多時候需要根據key words關鍵字去匹配對應的值,對於大量的資料而已,如果使用like,或者instr函式,速度則會很慢,這個時候,全文檢索對比其他的模糊查詢,有著明顯的速度優勢。但是因為分詞,所以會占用的一定的空間。如果空間足夠以及對速度有一樣的需求,可以考慮全文檢索。根...