在MS Word / PDF上显示从Oracle全文索引中提取的文本

时间:2019-03-24 00:49:41

标签: oracle

需要在MS word和pdf文件上创建全文本索引,并提取符合某些条件的文本。

我尝试对https://oracle-base.com/articles/9i/full-text-indexing-using-oracle-text-9i执行以下步骤以导入文件并在文件上创建索引,但是我需要显示与select语句匹配的实际文本。反正我能做到吗?

 CREATE TABLE my_docs (
   id    NUMBER(10)     NOT NULL,
   name  VARCHAR2(200)  NOT NULL,
   doc   BLOB           NOT NULL
 );

 ALTER TABLE my_docs ADD (
   CONSTRAINT my_docs_pk PRIMARY KEY (id)
 );

 CREATE SEQUENCE my_docs_seq;

 CREATE OR REPLACE DIRECTORY documents AS 'C:\work';

 CREATE OR REPLACE PROCEDURE load_file_to_my_docs (p_file_name  IN                 
    my_docs.name%TYPE) AS
   v_bfile      BFILE;
   v_blob       BLOB;
 BEGIN
   INSERT INTO my_docs (id, name, doc)
   VALUES (my_docs_seq.NEXTVAL, p_file_name, empty_blob())
   RETURN doc INTO v_blob;

   v_bfile := BFILENAME('DOCUMENTS', p_file_name);
   Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
   Dbms_Lob.Loadfromfile(v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
   Dbms_Lob.Fileclose(v_bfile);

   COMMIT;
 END;
 /

 EXEC load_file_to_my_docs('FullTextIndexingUsingOracleText9i.doc');

0 个答案:

没有答案