Insert Word File in Oracle 8i database

Can any one help me to insert one MS-Word File created thru a VB Application into Oracle Table.

Hi,
u can use pl/sql procedure to insert doc into database
Have a look
store microsoft doc into oracle database by clob
SQL> desc test
Name Null? Type
NO NUMBER
FILE_DATA CLOB
SQL> select * from all_directories;
OWNER DIRECTORY_NAME
DIRECTORY_PATH
SYS DIR_FILE
/oradata4/upd
create or replace procedure doc_insert(file_name varchar2)
as
f_lob bfile;
c_lob clob;
begin
insert into test (no,file_data) values
(1,empty_clob())
return file_data into c_lob;
f_lob := bfilename( 'DIR_FILE', file_name );
dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
dbms_lob.loadfromfile
( c_lob, f_lob, dbms_lob.getlength(f_lob) );
dbms_lob.fileclose(f_lob);
commit;
end;
Procedure created.
SQL> exec doc_insert('lob_case.doc');
PL/SQL procedure successfully completed.
SQL>
select dbms_lob.getlength(FILE_DATA),file_data from test;
DBMS_LOB.GETLENGTH(FILE_DATA)
FILE_DATA
46592
ÐÏ à¡± á > þÿ V X þÿÿÿ U
================================================
Retrive doc from oracle database
declare
clob_loc CLOB;
buffer VARCHAR2(32767);
buffer_size CONSTANT BINARY_INTEGER := 32767;
amount BINARY_INTEGER;
offset NUMBER(38);
file_handle UTL_FILE.FILE_TYPE;
directory_name CONSTANT VARCHAR2(80) := '/oradata4/upd/all';
new_xml_filename CONSTANT VARCHAR2(80) := 'lob_case.doc';
BEGIN
DBMS_OUTPUT.ENABLE(100000);
-- GET CLOB LOCATOR
SELECT file_data INTO clob_loc
FROM test
WHERE no = 1;
file_handle := UTL_FILE.FOPEN(
location => directory_name,
filename => new_xml_filename,
open_mode => 'w',
max_linesize => buffer_size);
amount := buffer_size;
offset := 1;
-- READ FROM CLOB / WRITE OUT NEW XML TO DISK
WHILE amount >= buffer_size
LOOP
DBMS_LOB.READ(
lob_loc => clob_loc,
amount => amount,
offset => offset,
buffer => buffer);
offset := offset + amount;
UTL_FILE.PUT(
file => file_handle,
buffer => buffer);
UTL_FILE.FFLUSH(file => file_handle);
END LOOP;
UTL_FILE.FCLOSE(file => file_handle);
END;
Thanks
Kuljeet

Similar Messages

  • How to store txt file into Oracle 7 Database using Pro*C

    Hi,
    I want to store a txt file into Oracle 7 database table using
    Pro*C application. But do not know what type of column to use.
    At first glance it appeared to me as LONG can serve the purpose
    but later I noticed that I can not do the sequential read/write
    in LONG type of column. That is, I have to use chunks of max of
    2GB (or file lenght) to read/write into such columns.
    I want something simiar to CLOB of Oracle 8.
    I would appreciate if you can provide me solution.
    Thanks,
    Anurag

    You store images in a BLOB column in the database.
    However, inserting image in that column and displaying data/image from that column are 2 very different tasks.
    If you are using Oracle forms, displaying is easy. Default block sitting on the table with BLOB column, can be easily mapped to image box (or similar control), which will display that image.
    Inserting images will be a different ball game. If your forms are web based (i.e. run from browser) and you want to insert images from client machine, some special arrangements are required.
    If images are on database server and you want to insert them in database, the stored procedure given in the earlier thread (posted above) will do the job.

  • Storing Word, Excel, Image files in Oracle 8i database

    How do I insert MS Word, MS Excel, and image files in Oracle 8i db. Do I need to use Developer Forms for using this functionality. If I am trying to insert data in Oracle through Java Servlets, what SQL should I use for inserting BLOB/LOB in Oracle database.

    Vidhyut,
    Check out the documentation on how to use JDBC to access/manipulate LOBs at http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88879/adl03p10.htm#241526.
    Regards,
    Geoff

  • INSERTING WORD FILE

    Dear All
    I have a word file with 5/6 pages of agreement typed, I want to know how to insert the word file in the table, and how to open the file from oracle forms. My table has two columns
    1. purpose varchar2(100),
    2. file_name blob
    Thanks
    Satish

    What forms version do you use? if it's 10G or above, you can use WEBUTIL_FILETRANSFER for this.

  • Print Word File from Oracle Report Builder 6.0

    Dear All
    I am using Reports 6 , I have a requirement that i have to print a word document (somewhere around 8 to 9 pages) after printing a report is there any way to execute the same. The word file has the details like agreement , etc so each and every time when i print that particular report , i want to print the contents also which is there in word file. If possible please tell me the steps to do. Thanks in Advance.
    V.Sat

    Possibilities are a bit limited. You can embed a word file as an OLE object in Reports.
    However, OLE can only display one page. So, you have to split your original documents in several one page documents. Put each page in a separate OLE field.
    You can also put the OLE pages (again, single pages only) in a BLOB in the database. In a query you select the pages from the BLOB.
    You have to store the pages through Forms, though. You cannot simply upload them to the table through pl/sql.

  • Bulk Insert CSV file in Oracle 9i

    Greetings all,
    Is there a similar way in Oracle to the Bulk Insert Command in SQL Server to bulk load a csv file in Oracle?
    Something else then the External Table and the SQL*Loader.
    Sincerely
    Dan

    Here is an example:
    CREATE TABLE EXT_ASSC
       (     LEVEL_1 VARCHAR2(30),
         LEVEL_2 VARCHAR2(50),
         CATEGORY_CODE VARCHAR2(100),
         LEVEL_3 VARCHAR2(100)
       ORGANIZATION EXTERNAL
        ( TYPE ORACLE_LOADER
          DEFAULT DIRECTORY some_directory
          ACCESS PARAMETERS
          ( RECORDS DELIMITED BY NEWLINE
              NODISCARDFILE
              NOLOGFILE
              BADFILE 'my_bad_file.bad'
            FIELDS
              TERMINATED BY ','
              LRTRIM
              MISSING FIELD VALUES ARE NULL
          LOCATION
           ( 'some_file.csv'
       REJECT LIMIT UNLIMITED;

  • Exporting of files in oracle 10g database

    hey friends,
    I installed Oracle 10g Database server on Windows XP,when i tried to take the backup through "Export to Files".I got this error.
    I have added Administrator in "Login as Batch JOb" and has given administrator along with the password in host credentials.
    I explain the procedure.I Login as Sys as SysOper as Oracle does not allow to take backup as sysdba.
    I created the job and also given the right path for the backup but some how it fails then i check the log and i find the following output.
    Output Log
    Export: Release 10.1.0.2.0 - Production on Fri Mar 4 16:39:23 2005
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Username:
    EXP-00004: invalid username or password
    Username: Password:
    EXP-00004: invalid username or password
    Username:
    EXP-00030: Unexpected End-Of-File encountered while reading input
    EXP-00000: Export terminated unsuccessfully
    The output log says i am giving invalid username and password but i don't know where i am giving the invalid username and password.
    Please guide me as I am new to Oracle and want to learn Oracle Administration.
    Thanks & Regards
    Ankush

    Give me output of following on standby server
    SQL>select name from v$datafile;
    SQL>show parameter log_archive_dest

  • Urgent - pls help - Problem while inserting binary file into Oracle DB

    Hi,
    I am trying to insert binary files into a Blob column in a Oracle 10G table.
    The binary files would be uploaded by the web users and hence come as multipart request. I use apache commons upload streaming API to handle it. Finally i am getting a input stream of the uploaded file.
    The JDBC code is
    PreparedStatement ps=conn.prepareStatement("insert into bincontent_table values(?)");
    ps.setBinaryStream(1,inStream,length);
    My problem starts when i try to find the length of the stream. available() method of inputstream does not return the full length of the stream. so i put a loop to read thru the stream and find the length as shown below
    int length=0;
    while((v=inStream.read())!=-1)
    length++;
    Now, though i got the length, my stream pointer has reached the end and i cant reset it(it throws an error if i try).
    So i copied the stream content to a byte array and created an ByteArrayInputStream like this.
    tempByteArray=new byte[length];
    stream.read(tempByteArray,0,length);
    ByteArrayInputStream bais=new ByteArrayInputStream(tempByteArray);
    Now if i pass this bytearray input stream instead of the normal input stream to the prepared statement's setBinaryStream() method it throws an error as
    "ORA-01460: unimplemented or unreasonable conversion requested".
    Now how to solve this?
    My doubts are ,
    1) preparedStatement.setBinaryStream(int parameterIndex, InputStream x, int length) expects an inputstream and its length. if i have the stream how to find its length with out reading the stream?
    2) Also as the length parameter is a integer, what if i have a large binary file whose length runs more than the capacity of integer
    3) Alternatively there is a setBlob(int i, Blob x) in prepared statement. But how to instantiate a Blob object and set it here
    4) Is there any better way to do this.
    Thanks in advance

    "ORA-01460: unimplemented or unreasonable conversion
    requested".When the setBinaryStream method is used, the driver may have to do extra work to determine whether the parameter data should be sent to the server as a LONGVARBINARY or a BLOB (reference: javadoc)
    1) preparedStatement.setBinaryStream(int parameterIndex,
    InputStream x, int length) expects an inputstream and its length. if i
    have the stream how to find its length with out reading the stream?no. stream may have no specified length. i think you have wrong understanding about stream.
    2) Also as the length parameter is a integer, what if i have a large
    binary file whose length runs more than the capacity of integer
    3) Alternatively there is a setBlob(int i, Blob x) in prepared statement.
    But how to instantiate a Blob object and set it here
    4) Is there any better way to do this.use ps.setBlob(1, instream) instead

  • Tnsnames.ora / listener.ora files on Oracle Standby Database

    Hi I am configuring an Oracle Standby Database to my production system 4.7 and Oracle 9.2.0.4
    My production server is: PR01
    Database SID: PRD
    Standby database server is: PRDR
    Database SID: PRD
    I have already configured the server to a standby database offline backup. Was generated the control files of the standby database and the database is in standby mode.
    Now I will create a script to start the synchronization of offline redolog from the production server to standby server.
    I have a question: in the document SAP Oracle Standby Database, tells me I should change the tnsnames.ora production server pointing to an additional entry disaster recovery server. The tnsnames.ora  file must have two entries???  corresponding to a production server and another to the disaster recovery server??
    In several links of oracle tells me I should configure listener.ora disaster recovery server that is true??
    Guys my question is: where should I change my listener.ora and tnsnames.ora files?
    Please clear my doubt.
    Best regards,
    Desiree

    Hi Desiree,
    The entry in your TNSNAMES.ORA is a nothing but a tns service, when you define archive log destination it will point to a service. This service's host name will be resolved in your tnsnsmaes.ora file.
    Below is the eg of an entry in pfile:
    *.log_archive_dest_2='SERVICE=<service_name> ARCH OPTIONAL'
    Below is the entry in your tnsnames.ora file
    <service_name>.WORLD=
      (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =
              (COMMUNITY = SAP.WORLD)
              (PROTOCOL = TCP)
              (HOST = <DR_HOST>)
              (PORT = 1527)
        (CONNECT_DATA =
           (SID = <DB_SID>)
           (GLOBAL_NAME = <DB_SID>.WORLD)
    So, your tnsnames.ora will have one entry for your host and the other for the DR host, i.e two entries.
    Listener entry for the convenience when there is a switch over.
    Regards,
    Bala

  • Create a PDF or Word file from Oracle row data

    Hi experts, I am clueless as how to do this. Please help.
    What I would like to do is to create multiple documents from rows return from my select SQL.
    Example:
    select id, name from employee;
    Return 2 rows:
    E01, Bob
    E02, John
    I would like either 2 PDF or 2 WORD documents that contain E01-Bob for document#1 and E02-John for document#2 in a specific directory.
    How do I do that?
    Thanks,
    lwt
    Edited by: user13379227 on Jul 8, 2010 1:37 PM

    You can buy a front-end reporting tool like Oracle BI Publisher and use it to create Word documents or PDFs, use the Word mail-merge feature with an ODBC data source to connect to your oracle database or, as Toon said, download the MS-Word document specifications from microsoft or the PDF specifications from Adobe and figure out how to programatically generate a document that meets those specifications.
    Regards,
    Bob

  • Parsing the word file using oracle text having tables within it............

    Hi,
    I was going through this document.Actually I am going to implement something like full text search functionality in our system.
    We get the info as .doc file.
    Earlier what we used to do is, we used to parse the file and store it into the database and then searched using PL/SQL.
    But what I understand from this article that this can be done using oracle text also.
    One concern is that whether the oracle text is able to parse the .doc file having tables embedded within it.
    Please let me know about this.(Whether oracle text will be able to parse the files having tables embedded within it).
    I am attaching an example file for this.
    Please let me know about this as early as possible.

    Yes Oracle Text have this capability. Use AUTO_FILTER or USER_FILTER to create index

  • Issue with Date Conversion when loading XML File into Oracle 10g Database

    Hello all,
    I have the interface shown in the screenshot below. In it, amongst other actions, I'm mapping an XML file element representing a date to an Oracle table column defined as DATE. The source and target columns are highlighted in the screenshot.
    !http://img223.imageshack.us/img223/1565/odiscr275.jpg!
    When I execute the interface, I get the following error message:
    java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:103)
    I'm assuming this refers to the date conversion!
    I've already tried replacing SRC_TRADES.DEAL_DATE with TO_DATE( SRC_TRADES.DEAL_DATE, 'DD/MM/YYYY' ) in the Implementation tab. This function was not recognised when I executed the interface, so it didn't work! The date value in the XML file is in DD/MM/YYYY format.
    I'm guessing that Oracle SQL Date functions don't work in the Implementation tab. Please could somebody let me know:
    1. Which Date Conversion function I could use instead?
    2. Where I can find a reference for the methods/functions I can use in the Implementation tab (if such a reference exists)?
    Cheers.
    James

    Hi.
    Try to change the execution area to staging area. After You change it, write in the mapping box just SRC_TRADERS.DEAL_DATE. When You use TO_DATE, the source field typu should be varchar2, not date (as it is in your source datastore)

  • How to Load XML files into Oracle 8 database.

    My company is currently using Oracle Aplications V. 10.7 character mode and intend to migrate to V.11.0.3 in the next months.
    We want to import data (XML format) in the OE module using Open Interfaces.
    How to proceed ?

    This forum is dedicated to the XML Features of 9iR2, and to a lesser extent 9i. Questions related to XML and earlier versions of the database should be posted in Technologies -> General -> XML...
    I will move this thread to the appropriate forum if required.

  • Need to load data from source .CSV files to oracle target database.

    Hi,
    This is the my scenario
    I have .CSV files in ftp folder and need to load the data into target tables.
    For that i need to create package and load the data into daily basis.
    But some time .csv file name will vary daily basis.
    can you any one suggest me???
    Thanks in Advacne.
    Zakeer

    Dear Roy,
    Thanks for your response
    Now I am able to extract the .zip file OdiUnZip (file). and loading data into target this is chapping in static way
    and my scenario is that some time i will get .zip files with different names with different .csv files
    i need to dynamically find the new .zip file and extract it and load the data into target.
    Please advice me..
    Thanks in advance
    Zakeer

  • How to read and upload microsoft word file into database using forms9i

    Hi,
    How to read and upload microsoft word file into oracle database using forms9i. I appretiate if anyone can send me example or atleast a sujjetion.
    Thanks in advance
    Mahesh Ragineni

    The webutil package includes the ability up upload from the client to the database. See otn.oracle.com/products/forms and click on webutil for more details.
    Regards
    Grant Ronald
    Forms Product Management

Maybe you are looking for