Home » SQL & PL/SQL » SQL & PL/SQL » Insert Images in a BLOB Datatype?
Insert Images in a BLOB Datatype? [message #19097] Thu, 28 February 2002 05:27 Go to next message
Kalpa
Messages: 21
Registered: February 2002
Junior Member
My Database version is oracle 9i..
How do i insert images in a BLOB datatype?
Re: Insert Images in a BLOB Datatype? [message #19099 is a reply to message #19097] Thu, 28 February 2002 05:45 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
1.Create a table to store the blobs:

create table blobs
( id varchar2(255),
blob_col blob
);

2. Create a logical directory in the database to the physical file system:

create or replace directory MY_FILES as 'c:images';

3.
Create a procedure to load the blobs from the file system using the logical
directory. The gif "aria.gif" must exist in c:images.

create or replace procedure insert_img as
f_lob bfile;
b_lob blob;
begin
insert into blobs values ( 'MyGif', empty_blob() )
return blob_col into b_lob;

f_lob := bfilename( 'MY_FILES', 'aria.gif' );
dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
dbms_lob.fileclose(f_lob);
commit;
end;
/
Re: Insert Images in a BLOB Datatype? [message #21348 is a reply to message #19097] Fri, 26 July 2002 23:07 Go to previous message
sathya
Messages: 27
Registered: December 2000
Junior Member
hi,

How to insert and retrieve a Excel file(*.xls) into oracle table. Let me know the code possibly in VB6.0

regards
sathya
Previous Topic: To Restricte User to Login in SQL*Plus.
Next Topic: A strange problem
Goto Forum:
  


Current Time: Fri Apr 19 01:34:57 CDT 2024