I created a file - C:\images\Raffles.jpg on my PC(XP), and I am trying to insert this jpg into blobs in my test database, and this is what I did(*I copied the following script from beta.expert-echange.com for testing purposes)
I kept getting:

ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "SYS.DBMS_LOB", line 504
ORA-06512: at "SIMT.INSERT_IMG", line 9
ORA-06512: at line 1

I read something like the above directory should be created in the Oracle Server. So if I changed C:\ to '\tmp', it's still gave me the same error.

Please advise.
Thanks in advance.


SQL> create table blobs
2 (id varchar2(255),
3 blob_col blob
4 );

Table created.

SQL> create or replace directory MY_FILES as 'c:\iamges';

SQL> l
1 create or replace procedure insert_img (p_id varchar2, p_filename varchar2)
2 as
3 f_lob bfile;
4 b_lob blob;
5 begin
6 insert into blobs values (p_id, empty_blob())
7 return blob_col into b_lob;
8 f_lob := bfilename('MY_FILES', p_filename);
9 dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
10 dbms_lob.loadfromfile (b_lob, f_lob, dbms_lob.getlength(f_lob));
11 dbms_lob.fileclose(f_lob);
12 commit;
13* end;
SQL> /

Procedure created.

SQL> desc blobs
Name Null? Type
----------------------------------------- -------- ----------------
ID VARCHAR2(255)
BLOB_COL BLOB

SQL> exec insert_img ('image1', 'Raffles.jpg');
BEGIN insert_img ('image1', 'Raffles.jpg'); END;

*
ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "SYS.DBMS_LOB", line 504
ORA-06512: at "SIMT.INSERT_IMG", line 9
ORA-06512: at line 1