DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: Insert ing word doc into oracle database

  1. #1
    Join Date
    Feb 2003
    Posts
    12

    Insert ing word doc into oracle database

    Hi Guys,
    How do i insert a word document in to oracle database? What datatype should i use.

    example:

    I have a word document or a text file and i want this file to be inserted into oracle database....& what should be my datatype?

  2. #2
    Join Date
    Nov 2002
    Location
    New Delhi, INDIA
    Posts
    1,796
    Amar
    "There is a difference between knowing the path and walking the path."

    Amar's Blog  Get Firefox!

  3. #3
    Join Date
    Jan 2002
    Location
    Netherlands
    Posts
    1,587
    There are examples in the manual. Lots of 'em.
    search the development forum, I think I did post something there last fall.
    Tarry Singh
    I'm a JOLE(JavaOracleLinuxEnthusiast)
    TarryBlogging
    --- Everything was meant to be---

  4. #4
    Join Date
    Jan 2002
    Location
    Netherlands
    Posts
    1,587
    BTW that was for castlerock, apparently he withdrew his post...
    Tarry Singh
    I'm a JOLE(JavaOracleLinuxEnthusiast)
    TarryBlogging
    --- Everything was meant to be---

  5. #5
    Join Date
    Feb 2003
    Posts
    12
    Hi,
    I have inserted the word doc inside the database using the code below. How you i retrive it from the database. Any suggestions!

    create or replace directory MY_FILES as 'C:\Uploadfolder';


    Create table emp1

    Create table emp1(
    EMPNO number(30),
    EMPNAMe varchar2(10),
    RESUME BLOB);


    To check the path is set in the dba_directories:

    select * from dba_directories;

    ***************
    declare

    f_lob bfile;
    b_lob blob;

    begin

    insert into emp1(empno,empname,resume)
    values ( 1001, 'BILLGATES',empty_blob() )
    return resume into b_lob;
    -- resume is the field name in my table which has BLOB data type
    f_lob := bfilename( 'MY_FILES', 'Purchase.doc' );
    dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
    dbms_lob.loadfromfile
    ( b_lob, f_lob, dbms_lob.getlength(f_lob) );
    dbms_lob.fileclose(f_lob);

    commit;

    end;
    /

    The doc is sucessfully inserted in the database .

    How do i retrive the data back?

    Thanks,

  6. #6
    Join Date
    Sep 2000
    Location
    Sao Paulo,SP,Brazil, Earth, Milky Way
    Posts
    350
    Using PL/SQL, you can retrieve LOBs/BLOBs using the routines in the DBMS_LOB package, ** BUT ** you must want to SHOW the contents, I believe. PL/SQL, being a "batch", "server-side" language, don´t know anything about .doc format, so you MUST use other tools/language (probably in client side) to do it : Forms is capable, Vb too, Delphi, C and some others.
    Oracle sells some add-ons (intermedia) to do it inside the database, it is another option, or maybe java - the point is , with STANDARD PL/SQL & simple clients (like sql*plus), you CAN´T DO IT.

    []s

    Chiappa

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