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!

ORA-22285: non-existent directory/file FILEOPEN operation for upload file?

orabitsJan 13 2006 — edited May 26 2011
Hi TOM,
1. Create or Replace directory My_UpLoadDir as 'Z:\temp';
2. Grant all on directory My_UpLoadDir to aims;
Above these two steps done in sys. and utl_file_dir=* inserted in init.ora file.
The procedure is ...
CREATE OR REPLACE PROCEDURE load_file (
pdname VARCHAR2, -- directory name
pfname VARCHAR2 -- file name
) IS

src_file BFILE; -- source file
dst_file BLOB; -- designation file
lgh_file BINARY_INTEGER; -- file length

BEGIN
src_file := bfilename(pdname, pfname);

-- insert a NULL record to lock
INSERT INTO pdm
(dname, fname, iblob)
VALUES
(pdname, pfname, EMPTY_BLOB())
RETURNING iblob INTO dst_file;

-- lock record
SELECT iblob
INTO dst_file
FROM pdm
WHERE dname = pdname
AND fname = pfname
FOR UPDATE;

-- Open the file
dbms_lob.fileopen(src_file, dbms_lob.file_readonly);

-- Determine length
lgh_file := dbms_lob.getlength(src_file);

-- read the file
dbms_lob.loadfromfile(dst_file, src_file, lgh_file);

-- Update the blob field
UPDATE pdm
SET iblob = dst_file
WHERE dname = pdname
AND fname = pfname;

-- Close file
dbms_lob.fileclose(src_file);

END load_file;

For executing...I given a value for these two parameter is...
pdname='z:\temp'
pfname='myfile.txt' - it's already exist in that directory.


But, i facing this kind of problem....
ORA-22285: non-existent directory or file FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 475
ORA-06512: at AIMS.LOAD_FILE", line 29
ORA-06512: at line 3

View program sources of error stack?


Plz, provide a solution for this.....
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 23 2011
Added on Jan 13 2006
12 comments
45,975 views