ORA-29285 File Write error

I am writing a stored procedure that writes to a file. Code pertaining to utl_file -

v_feed_out               UTL_FILE.FILE_TYPE;

BEGIN
  IF UTL_FILE.IS_OPEN (v_feed_out)
    THEN UTL_FILE.FCLOSE (v_feed_out);
  END IF;
 v_feed_out := utl_file.fopen('FAMIS_OUTPUT_DIR', 'ABC','w');


  OPEN ref_cursor for 'select * from ' || v_tbl_tmp;
  LOOP
       FETCH ref_cursor INTO V_DTL_REC.NAME,
                           V_DTL_REC.GENDER,
                           V_DTL_REC.STREET,
                           V_DTL_REC.CITY,
                           V_DTL_REC.STATE,
                           V_DTL_REC.ZIP,
                           V_DTL_REC.DOB,
                           V_DTL_REC.CLSSFCN,
                           V_DTL_REC.STATE_OF_ORIGIN,
                           V_DTL_REC.PHONE;
                           
                           
     
       V_DTL_REC.NAME := LPAD( V_DTL_REC.NAME, 120 );
       V_DTL_REC.STREET := LPAD( V_DTL_REC.STREET, 120 );
       V_DTL_REC.CITY := LPAD( V_DTL_REC.CITY, 25 );
       V_DTL_REC.STATE := LPAD( V_DTL_REC.STATE, 2 );
       V_DTL_REC.ZIP := LPAD( V_DTL_REC.ZIP, 10 );
       V_DTL_REC.STATE_OF_ORIGIN := LPAD( V_DTL_REC.STATE_OF_ORIGIN, 3 );
       V_DTL_REC.PHONE := LPAD( V_DTL_REC.PHONE, 10 );
       V_DTL_REC.UIN := LPAD( V_DTL_REC.UIN, 9 );
       
       V_OUTPUT_REC:=  V_DTL_REC.NAME ||
                       V_DTL_REC.STREET ||
                       V_DTL_REC.CITY ||
                       V_DTL_REC.STATE ||
                       V_DTL_REC.ZIP ||
                       V_DTL_REC.DOB ||
                       V_DTL_REC.CLSSFCN ||
                       V_DTL_REC.STATE_OF_ORIGIN ||
                       V_DTL_REC.PHONE ||
                       V_DTL_REC.UIN;
                     
       /*DBMS_OUTPUT.put_line( V_OUTPUT_REC ); */
       utl_file.put_line(v_feed_out, v_output_rec, TRUE);  
                           
       
   END LOOP;
   utl_file.fclose_all()
END;

When I am debugging, I see that atleast six rows have been processed and then I get a

ORA-29285: file write error
ORA-06512: at "SYS.UTL_FILE", line 171
ORA-06512: at "SYS.UTL_FILE", line 1093
ORA-06512: at "SYS.UTL_FILE", line 821

The data which is being read looks good to me. I dont know what I am missing. The output file is being created, but not all rows that have been looped through were written into the file.

Thanks

 

 
happylife1234Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

schwertnerCommented:
The directory  'FAMIS_OUTPUT_DIR' should be defined correctly
1. It should exist as logical directory,
2. The user should given write access to it
3. The underlying physical directory should exist
4. The oracle OS user should have permissions to write there.
0
happylife1234Author Commented:
The directory is set properly. Both logical and physical and The output file has been created with few rows written to it.
0
schwertnerCommented:
Disk is full.
Some of the columns is a LOB
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

schwertnerCommented:
Also if the file exists you shoul use 'append' mode
0
happylife1234Author Commented:
I want to overwrite the same file everythime I run this stored procedure. And the disk is not full since I am able to run another store procedure that can write to the same folder. None of the columns are LOB they are simple names and addresses columns.

I dont know what could be the problem then.
0
schwertnerCommented:
Remove the file first.

The FREMOVE procedure removes a file from the system.

FREMOVE(location VARCHAR2, filename VARCHAR2)
An exception is thrown if the file to be removed does not exist.

Parameters

location

Directory name, as stored in pg_catalog.edb_dir.dirname, of the directory containing the file to be removed.

filename

Name of the file to be removed.

Examples

The following removes file empfile.csv.

DECLARE
    v_directory     VARCHAR2(50) := 'empdir';
    v_filename      VARCHAR2(20) := 'empfile.csv';
BEGIN
    UTL_FILE.FREMOVE(v_directory,v_filename);
    DBMS_OUTPUT.PUT_LINE('Removed file: ' || v_filename);
    EXCEPTION
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE('SQLERRM: ' || SQLERRM);
            DBMS_OUTPUT.PUT_LINE('SQLCODE: ' || SQLCODE);
END;

Removed file: empfile.csv
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.