Skip to Main Content

SQL & PL/SQL

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!

insert image in blob field in oracle

SiddikJul 25 2012 — edited Jul 30 2012
Hi,
I am getting below eror to insert image file in bloc field.


ORA-22288: file or LOB operation FILEOPEN failed
The system cannot find the path specified.
ORA-06512: at "SYS.DBMS_LOB", line 744

below are my SP:

CREATE OR REPLACE PROCEDURE DRFSMS.iPAD_Image_Load(vParcel_ID IN VARCHAR2, vSerial_No IN NUMBER, vFileName IN VARCHAR2) IS
l_source BFILE;
l_dest BLOB;
l_length BINARY_INTEGER;
BEGIN

l_source := BFILENAME ('PHOTO_DIR', vFileName);

INSERT INTO WS_PARCEL_SS_IMAGES (Parcel_ID, Serial_No,Image_File) VALUES (vParcel_ID,vSerial_No, EMPTY_BLOB () )
RETURNING Image_File INTO l_dest;
-- lock record
SELECT Image_File INTO l_dest FROM WS_PARCEL_SS_IMAGES WHERE PARCEL_ID = vParcel_ID AND Serial_No= vSerial_No FOR UPDATE;
-- open the file
DBMS_LOB.fileopen (l_source, DBMS_LOB.file_readonly);
-- get length
l_length := DBMS_LOB.getlength (l_source);
-- read the file and store in the destination
DBMS_LOB.loadfromfile (l_dest, l_source, l_length);
-- update the blob field with destination
UPDATE WS_PARCEL_SS_IMAGES SET Image_File = l_dest WHERE PARCEL_ID = vParcel_ID AND Serial_No= vSerial_No;
-- close file
DBMS_LOB.fileclose (l_source);
END iPAD_Image_Load;

belows are the inputs:

DECLARE
VPARCEL_ID VARCHAR2(32767);
VSERIAL_NO NUMBER;
VFILENAME VARCHAR2(32767);

BEGIN
VPARCEL_ID := 'N00O-240';
VSERIAL_NO := 2;
VFILENAME := 'photo_dir/N00O-222_1.jpg';

DRFSMS.IPAD_IMAGE_LOAD ( VPARCEL_ID, VSERIAL_NO, VFILENAME );
COMMIT;
END;

pls. anyone please help me.
advance thnx.

Regards,

Siddik

Edited by: Siddik on Jul 30, 2012 12:06 PM
This post has been answered by JustinCave on Jul 30 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2012
Added on Jul 25 2012
6 comments
1,069 views