Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Store large Word or PDF file in DB

Re: Store large Word or PDF file in DB

From: Stefano Biotto <sbiotto_at_tiscali.it>
Date: Mon, 21 Jan 2002 21:53:52 +0100
Message-ID: <a2hv4p$j1e$1@pegasus.tiscalinet.it>


Niall Litchfield wrote:

> look into the BLOB datatype (8i and above). You can either store the data
> directly or as a BFILE (external file reference).
>
>
> --
> Niall Litchfield
> Oracle DBA
> Audit Commission UK
> *****************************************
> Please include version and platform
> and SQL where applicable
> It makes life easier and increases the
> likelihood of a good answer
>
> ******************************************
> "cschang" <cschang_at_maxinter.net> wrote in message
> news:3C426609.20709_at_maxinter.net...

>> Is it possible to storage a very larg word file ( more than 4K
>> charcaters) or even PDF type file into database?  So I can use some kind
>> of ID column to be referenced by other .   I have a small set of records
>> which each row is associated with  a larger text file and gif file.  So
>> I try to put the large word ( or PDF that will include some picture in
>> it) into another table but use a foreign ID to reference them.   Thanks.
>>
>> C CHang
>>

You have to create a table with a blob column: create table t_blob(id number not null primary key,

                    blob_file blob);

Create a link to the directory where the file to load in the blob is (connect as system then grant read privilege to your user): create or replace directory blob_dir as 'C:\Documents';

Custom the following procedure that I copied from a Thread

create or replace procedure blob_ins(p_id in number, p_filename in varchar2) as

  l_bfile     bfile;
  l_blob      blob;

begin
  insert into blob_test(p_id, empty_blob())   returning blob_file into l_blob;

  l_bfile := bfilename('BLOB_DIR', p_filename);

  dbms_lob.fileopen(l_bfile);
  dbms_lob.loadfromfile(l_blob, l_bfile, dbms_lob.getlength(l_bfile));
  dbms_lob.fileclose(l_bfile);

  commit;
  return;
end blob_ins;

This is for loading a binary file in the db, anyone knows how download the file stored in a lob in a new a file of the o.s.? Received on Mon Jan 21 2002 - 14:53:52 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US