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: Oracle 8 BLOB

Re: Oracle 8 BLOB

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Tue, 14 Apr 1998 20:45:19 GMT
Message-ID: <3533ca8d.18526870@192.86.155.100>


A copy of this was sent to Jerry.Drexler_at_corp.honeywell.com (if that email address didn't require changing) On 14 Apr 1998 16:54:33 GMT, you wrote:

>The oracle 8 documentation says I can store a BLOB in the database up to 4
>GBytes in size per field. The Oracle 8 OCI manual says 4000 bytes. I've tried
>loading binary data into a oracle 8 BLOB field using sql loader using the
>data type RAW in the control file. It burped if I specified a position of over
>4000 bytes in the control file. I'm not sure if this is because I use RAW or
>because it really only does store 4000 bytes internally.
>
>My binary data is made up of short ints, of 8192 points in length.
>The method I chose was to store this in a BLOB field using sql loader, and
>then retrieve it when needed with pro-c.
>
>Thanks for your help!
>Jerry

Its 4gig, not 4k.

The easiest way to load the blobs is using pl/sql actually. With SQLLDR you'll be fighting it to get it to load RAW binary data (newlines and all will really confuse it, it can be done its just not very easy or straight forward)

With pl/sql it'll look like:

create table blobs
( id varchar2(255),
  b_lob blob
)
/

create or replace directory MY_FILES as '/export/home/tkyte/public_html';

<<main>>
declare

    f_lob bfile;
    b_lob blob;
begin

    insert into blobs values ( 'MyGif', empty_blob() )     return b_lob into main.b_lob;

    f_lob := bfilename( 'MY_FILES', 'aria.gif' );     dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );     commit;
end;

So, you can use the dbms_lob.loadfromfile to load an OS file into the blob directly.  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Tue Apr 14 1998 - 15:45:19 CDT

Original text of this message

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