IT備忘録

LINUX関連 .NET関連 DB関連 正規表現 その他 情報


■テーブル構造
create table story(
author varchar2(100) primary key,
body varchar2(1000)
);

■検索用ユーザーの作成
create user user
identified by password
default tablespace users
temporary tablespace temp;

grant connect,resource to user;


■ールctxappをuserに与える。
grant ctxapp to user;

■プリファレンスの作成
begin ctx_ddl.create_preference(
'english_lexer', 'basic_lexer');
--日本語は
--ctx_ddl.set_attribute(
-- 'japanese_lexer', 'JAPANESE_VGRAM_LEXER');
--など

ctx_ddl.set_attribute(
'english_lexer', 'index_themes', 'no');

end;
/

■インデックスの作成
body列へのインデックスが作成可能となる。

create index song_index on story(body)
indextype is ctxsys.context
parameters('LEXER english_lexer STOPLIST ctxsys.default_stoplist');

このインデックスをSQL文で使用することができる。

select author from story where contains('body', 'database system', 1) > 0;

 リンク

Oracleでテキストインデックスを使用す
Oracleのテクニックを記
VARCHAR2をNUMBERに変換する際、桁数で怒られるときに桁数を無視するfunction
SQLのテクニックを記
[IT備忘録]のサイト内にある文章の正確性については一切責任を持ちません。
実開発の際には、技術的内容は十分確認した上で作業してください。

(C) 2010 IT備忘録 All rights reserved.