a, 1, 400, 24-oct-2002);
Insert into auction values(2, olympus camera, 1, 300, 25-oct-2002);
Insert into auction values(3, pentax camera, 1, 200, 26-oct-2002);
Insert into auction values(4, canon camera, 1, 250, 27-oct-2002);
Commit;
/
--确定你的查询条件(很重要)
--Determine that all queries search the title column for item descriptions
--建立索引集
begin
ctx_ddl.create_index_set(auction_iset);
ctx_ddl.add_index(auction_iset,price); /* sub-index a*/
end;
--建立索引
Create index auction_titlex on auction(title) indextype is ctxsys.ctxcat
parameters (index set auction_iset);
Column title format a40;
Select title, price from auction where catsearch(title, camera, order by price)> 0;
Title price
--------------- ----------
Pentax camera 200
Canon camera 250
Olympus camera 300
Nikon camera 400
Insert into auction values(5, aigo camera, 1, 10, 27-oct-2002);
Insert into auction values(6, len camera, 1, 23, 27-oct-2002);
commit;
/
--测试索引是否自动同步
Select title, price from auction where catsearch(title, camera,
price <= 100)>0;
Title price
--------------- ----------
aigo camera 10
len camera 23
添加多个子查询到索引集:
begin
ctx_ddl.drop_index_set(auction_iset);
ctx_ddl.create_index_set(auction_iset);
ctx_ddl.add_index(auction_iset,price); /* sub-index A */
ctx_ddl.add_index(auction_iset,price, bid_close); /* sub-index B */
end;
drop index auction_titlex;
Create index auction_titlex on auction(title) indextype is ctxsys.ctxcat
parameters (index set auction_iset);
SELECT * FROM auction WHERE CATSEARCH(title, camera,price = 200 order by bid_close)>0;
SELECT * FROM auction WHERE CATSEARCH(title, camera,order by price, bid_close)>0;
任何的Dml 操作后,Ctxcat 的索引会自动进行同步,不需要手工去执行,与ctxcat 索引相对应的查询操作符是catsearch.
语法:
Catsearch(
[schema.]column,
Text_query varchar2,