Storing an Image File in Oracle 8i and retrieving onto a Form [message #78571] |
Mon, 04 March 2002 03:02 |
Stuart Shepherd
Messages: 6 Registered: January 2002
|
Junior Member |
|
|
I am new to Oracle Forms and need some advice on storing an image (.gif, .jpg, .bmp files) in the database. Ideally I would like to allow the user to save the image into the database via a form and then be able to view the stored images on another form. I need to associate the image with an id from another table.
I have read around on the internet but cannot find much help on this. I could really do with an example of a similar solution to this. I don't mind whether the image itself is stored in the database or just the file name of the image, i just need a simple quick solution.
Can anyone help me on this?
Any help will be much appreciated, I'm desperate!
Regards
Stuart Shepherd
|
|
|
|
|
Re: Storing an Image File in Oracle 8i and retrieving onto a Form [message #78584 is a reply to message #78576] |
Mon, 04 March 2002 13:36 |
Stuart Shepherd
Messages: 6 Registered: January 2002
|
Junior Member |
|
|
Hi Pratap,
Thanks for you help on this matter it has been extremely helpful!
I have managed to read the image onto the form and save it into the database via the save icon in forms runtime toolbar.
If I want to add a button onto my form to allow the user to save/insert the image to the database table, what is the insert statement that I should use?
I have tried a standard insert, but it didn’t like the BLOB file. Can you give me an example of the code needed to save an image into the database via a form (6i)?
Any help on this will be greatly appreciated!
Regards
Stuart Shepherd
|
|
|
Re: Storing an Image File in Oracle 8i and retrieving onto a Form [message #78589 is a reply to message #78576] |
Mon, 04 March 2002 23:53 |
pratap kumar tripathy
Messages: 660 Registered: January 2002
|
Senior Member |
|
|
here is an example
SQL> desc blobs
Name Null? Type
------------------------------- -------- ----
ID VARCHAR2(255)
BLOB_COL BLOB
create directory My_files as 'c:temp';
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', 'c:tempemail.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;
|
|
|
|
|
|