Q

Saving files larger than 4K in Oracle 8

How can we save doc or text files that are larger than 4K in Oracle 8 or 8i through LOB? Please tell me in detail

with example.

Here is the code to load a file. It's straight to load the file:
-- the table you want to load to

drop table blobs;
create table blobs
( id        varchar2(255),
  theBlob   blob
)
/
-- declare a directory object
create or replace directory MY_FILES as '/export/home/tkyte/public_html';

-- script to load a file, aria.gif is the file to load:
declare
    l_bfile bfile;
    l_blob  blob;
begin
    insert into blobs values ( 'MyGif', empty_blob() )
    return theBlob into l_blob;

    l_bfile := bfilename( 'MY_FILES', 'aria.gif' );
    dbms_lob.loadfromfile( l_blob, l_bfile, dbms_lob.getlength(l_bfile) );
    commit;
end;
/
dbms_lob.loadfromfile does all the loading of file; the file must exist in the directory given by the MY_FILES directory.


This was first published in June 2002

Dig deeper on Oracle database backup and recovery

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close