Oracle C#实现Oracle Text全文检索的简单例子是本文我们主要要介绍的内容,。NET下用C# 实现Oracle Text全文检索的一个简单例子,旨在初步了解Oracle全文检索的大概步骤,你可以此基础上扩展,进行进一步的学习。希望能够对您有所帮助。Oracle全文检索的步骤如下:
DROP TABLE DOCS;
CREATE TABLE DOCS ( id NUMBER PRIMARY KEY, text VARCHAR2(80) );
INSERT INTO docs VALUES (1,'the first doc');
INSERT INTO docs VALUES (2,'the second doc');
COMMIT;
CREATE INDEX doc_index ON DOCS(text) INDEXTYPE IS CTXSYS.CONTEXT;
string connStr="Data Source=ora9; uid=scott; pwd=tiger; unicode=true";
string sqlStr = "SELECT ID FROM DOCS WHERE CONTAINS(TEXT,'%FIRST%')>0";
OracleDataAdapter da = new OracleDataAdapter(sqlStr, connStr);
DataTable dt = new DataTable();
da.Fill(dt);
Response.Write(dt.Rows[0][0].ToString());
create or replace procedure sync is begin execute immediate 'alter index doc_index rebuild online' || ' parameters ( ''sync'' )';
execute immediate 'alter index doc_index rebuild online' || ' parameters ( ''optimize full maxtime unlimited'' )';
end sync;
declare v_job number;
begin Dbms_Job.Submit ( job => v_job, what => 'sync;',
next_date => sysdate, /* default */ interval => 'sysdate + 1/720' /* = 1 day / ( 24 hrs * 30 min) = 2 mins */ );
Dbms_Job.Run ( v_job );
end;