次の各項では、ダイレクト、複数列、URLおよびファイルのデータストアの設定例を示します。
次の例では、テキスト・データを格納するCLOB列がある表を作成します。その後、2行のテキスト・データを移入し、DIRECT_DATASTOREプリファレンス型を使用するシステム定義プリファレンスCTXSYS.DEFAULT_DATASTOREを使用して表を索引付けします。
create table mytable(id number primary key, docs clob);
insert into mytable values(111555,'this text will be indexed');
insert into mytable values(111556,'this is a default datastore example');
commit;
create index myindex on mytable(docs)
indextype is ctxsys.context
parameters ('DATASTORE CTXSYS.DEFAULT_DATASTORE');
次の例では、これらのテキスト列は、連結されて索引付けされます。3つのテキスト列にmy_multiという複数列のデータストア・プリファレンスを作成します。
begin
ctx_ddl.create_preference('my_multi', 'MULTI_COLUMN_DATASTORE');
ctx_ddl.set_attribute('my_multi', 'columns', 'column1, column2, column3');
end;
この例では、my_urlというURL_DATASTOREプリファレンスを作成し、http_proxy、no_proxyおよびtimeoutの各属性を設定します。timeout属性は300秒に設定されます。属性を設定しない場合は、デフォルトが使用されます。
begin
ctx_ddl.create_preference('my_url','URL_DATASTORE');
ctx_ddl.set_attribute('my_url','HTTP_PROXY','www-proxy.us.example.com');
ctx_ddl.set_attribute('my_url','NO_PROXY','us.example.com');
ctx_ddl.set_attribute('my_url','Timeout','300');
end;