Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

storing PDF files using Blob

New YorkerMar 25 2010 — edited Mar 25 2010
Good Morning Everyone,


1) Create a directory(path)
C:\test\test.pdf

2) create a table to hold the BLOB:
create table test(
ID NUMBER,
DOCS BLOB
)

*****************************
3) import the file into a BLOB datatype and insert it into the table:
DECLARE
l_bfile BFILE;
l_blob BLOB;
BEGIN
INSERT INTO tab1 (col1)
VALUES (empty_blob())
RETURN col1 INTO l_blob;

l_bfile := BFILENAME('PDF', 'test.pdf');
DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly);
DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
DBMS_LOB.fileclose(l_bfile);

COMMIT;
END;
/

****************
I am wondering about the step 3.

Any help,

Thanks,

NY
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 22 2010
Added on Mar 25 2010
2 comments
337 views