Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ORA-29285 File Write error

Posted on 2009-07-13
6
Medium Priority
?
4,457 Views
Last Modified: 2012-08-14
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

 

 
0
Comment
Question by:happylife1234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 48

Expert Comment

by:schwertner
ID: 24840177
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
 

Author Comment

by:happylife1234
ID: 24840216
The directory is set properly. Both logical and physical and The output file has been created with few rows written to it.
0
 
LVL 48

Accepted Solution

by:
schwertner earned 750 total points
ID: 24840282
Disk is full.
Some of the columns is a LOB
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 48

Expert Comment

by:schwertner
ID: 24840343
Also if the file exists you shoul use 'append' mode
0
 

Author Comment

by:happylife1234
ID: 24840591
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
 
LVL 48

Expert Comment

by:schwertner
ID: 24841862
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question