DBAsupport.com Forums - Powered by vBulletin
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Search through MS Word documents in Oracle-db?

  1. #1
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317

    Search through MS Word documents in Oracle-db?

    Hello guys,

    I have a small problem. I want to upload MS Word documents into an Oracle db. Users must be able to search for words in these documents and if a certain document is found, the user must be able to download it.

    I guess BLOB's are good to up/download the doc's, but I don't know how to search through these documents.

    Which techniques can I use for this? Does anyone have an example? I looked at AskTom.com, but his links are all dead

    Thanks in advance,
    Erik
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  2. #2
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Hi Erik, I very much suspect that you can't simply search a Word doc stored as a BLOB (dump a Word doc and you will see why). I think you will need to extract the text and store that in a separate column. I'm sure I've seen tools on the web for this kind of conversion. (We use http://neevia.com for Word to pdf conversion - not sure if you can get to plain text with that).

  3. #3
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    Thanks DaPi! A third party tool is not applicable (there's little budget)

    Hmmm, so if OLE would be possible through PL/SQL, I could read the text and then place that in a different column and search on that text.

    So my thoughts are to build a insert/update-trigger that start a stored procedure which opens the document via OLE and extracts all required texts. Finally it stores the text in a VARCHAR2-column.

    Does anyone think this is possible? I'll search the web for examples, I'll keep you posted.
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  4. #4
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    I'm now downloading "OLE DB Provider" for my 9i release 2 db.

    I think this does the trick.
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  5. #5
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    I'm a bit dissapointed: OLE DB Provider and OLE DB Objects are all for communications from other programs. (contact Oracle from within Visual Basic, etc)

    Does anyone know if it is possible to start OLE Automation from within oracle? If it is not, I must create a different program (in a different language), but I want to solve this problem in Oracle...
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  6. #6
    Join Date
    Nov 2002
    Posts
    80
    intermedia has an MS word import filter (doesn't it?)

  7. #7
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    OLE is no good, COM Automation is the promissed land. I'm now reinstalling my examples so I can test something...

    OnlySimon, I'll look into that aswell !!

    Progress:
    - executed '[oracle_home]\com\comwrap.sql';
    - executed '[oracle_home]\com\demos\wordsol.sql';
    - executed '[oracle_home]\com\demos\worddem.sql';
    - worddem.sql halts on a ORA-28575 error. (reading metalink for solution)

    Followed Note 70638.1 and created a separate listener for extproc. "TNSPING extproc" works fine now.

    - executed '[oracle_home]\com\demos\worddem.sql' and it creates a MS Word-document! Let the party begin...!!

    COM Automation & Oracle is mega-cool!
    Last edited by efrijters; 01-19-2004 at 09:25 AM.
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  8. #8
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    Hey guys,

    (Maybe this question belongs in the development-section, but this still belongs in this thread).

    Since the MS Word example works, I've been looking for a way to create a function that reads the text from within a document.
    PHP Code:
    FUNCTION InsertText(textstr varchar2) return binary_integer IS
    BEGIN
        ORDCOM
    .InitArg();
        
    ORDCOM.SetArg(textstr,'BSTR');
        
    i:=ORDCOM.Invoke(applicationToken'Insert'1DummyToken);
        IF (
    i!=0THEN
        ORDCOM
    .GetLastError(error_srcerror_descriptionerror_helpfileerror_helpID);
        
    dbms_output.put_line(error_src);
        
    dbms_output.put_line(error_description);
        
    dbms_output.put_line(error_helpfile);
        
    END IF;
        return 
    i;
    END InsertText
    I have a question (given the write-example above):
    The "Invoke" function calls a specific function in MS Word: 'Insert'. Where can I find a list of available functions and their parameters of MS Word?

    Thanks in advance,
    Erik
    Last edited by efrijters; 01-21-2004 at 08:04 AM.
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  9. #9
    Join Date
    Oct 2002
    Location
    Breda, The Netherlands
    Posts
    317
    Progress:

    It must be something like:
    PHP Code:
    HRESULT:=ORDCOM.GetProperty(applicationToken'Text'0chartoken); 
    , but I keep on getting the error "-2147352567 wrong number of parameters"... :(

    I looked at AskTom + metalink + oracle documentation + otn + technet + installed com examples + google.com, but nobody does a read from a document...

    Am I missing something? (I don't want to use forms or extra tools, just PL/SQL!)
    An expert is one who knows more and more about less and less until he knows absolutely everything about nothing.

  10. #10
    Join Date
    Nov 2002
    Posts
    80
    if you hit a brick wall, look at using intermedia with the INSO_FILTER.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width