Solved

ORA-29285: file write error

Posted on 2004-10-06
5
4,074 Views
Last Modified: 2012-06-21
Hi,

I'm having issues with the following:

------------------------------------------------------------------------------
p_path:= 'TEST';
lv_file_handle  := UTL_FILE.FOPEN(p_path,REPLACE('test3.xls',' '),'W');

lv_text         := '<?xml version="1.0"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"                  xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">  <Author>'||USER||'</Author>  <LastAuthor>'||USER||'</LastAuthor>  <Created>'||REPLACE(TO_CHAr(sysdate,'YYYY-MM-DD HH24:MI:SS'),' ','T')||'Z'||'</Created>  <Company>British American Tobacco</Company><Version>1.0</Version> </DocumentProperties> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">  <DownloadComponents/> <LocationOfComponents HRef="file:///\\"/> </OfficeDocumentSettings> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"><WindowHeight>8835</WindowHeight><WindowWidth>11340</WindowWidth><WindowTopX>480</WindowTopX><WindowTopY>120</WindowTopY><ProtectStructure>False</ProtectStructure>  <ProtectWindows>False</ProtectWindows> </ExcelWorkbook><Styles><Style ss:ID="Default" ss:Name="Normal"><Alignment ss:Vertical="Bottom"/><Borders/><Font/><Interior/><NumberFormat/><Protection/></Style>
  <Style ss:ID="COLY"><Interior ss:Color="#FFFF99" ss:Pattern="Solid" /><Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/><Borders><Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1" /><Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1" /><Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1" /><Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1" /></Borders><Font x:Family="Swiss" ss:Bold="1"/></Style> <Style ss:ID="ALB9"><Interior ss:Color="#FFFFFF" ss:Pattern="Solid" /><Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/><Font x:Family="Swiss" ss:Size="9"/></Style> <Style ss:ID="ACB9"><Interior ss:Color="#FFFFFF" ss:Pattern="Solid" /><Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/><Font ss:Size="9" /></Style><Style ss:ID="ACG9"><Interior ss:Color="#C0FFC0" ss:Pattern="Solid" /><Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/><Font ss:Size="9" />  </Style><Style ss:ID="ARB9"><Interior ss:Color="#FFFFFF" ss:Pattern="Solid" /><Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/><Font x:Family="Swiss" ss:Size="9"/></Style></Styles><Worksheet ss:Name="'||p_path||'">
<Table>';

UTL_FILE.PUT(lv_file_handle,lv_text);
UTL_FILE.NEW_LINE(lv_file_handle);

----------------------------------------------------------------------
this will create the file in the directory.

if I then include

lv_columntext := '<Row><Cell  ss:StyleID="COLY"><Data ss:Type="String">Region</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">End Market</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">End Market desc</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Trade Channel</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Sold-to party</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Order reason</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Plant</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Point of mf</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Brand family</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Brand variant</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Material</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Order</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Line</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Original Request dt</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">End Market Request</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Goods issue date</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Shipping ETA</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Days late</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Qty requested</Data></Cell>
<Cell  ss:StyleID="COLY"><Data ss:Type="String">Qty shipped on time</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Quantity shipped on time</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">% on time</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Unit</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Reason code</Data></Cell><Cell  ss:StyleID="COLY"><Data ss:Type="String">Reason text</Data></Cell></Row>';

                              
UTL_FILE.PUT(lv_file_handle,lv_columntext);
UTL_FILE.FCLOSE(lv_file_handle);

-------------------------------------

i get ORA-29285: file write error

the file gets created but if I try and go into the file then it tells me that the file is locked.

i then tried passing all the values into the first UTL_FILE call and got the same error

the length of lv_text is approx 4500

any ideas?
0
Comment
Question by:joehodge
  • 3
  • 2
5 Comments
 

Author Comment

by:joehodge
ID: 12239128
Im using Oracle 9.1 and created the directory as:

CREATE OR REPLACE DIRECTORY TEST AS 'D:\KPI\Files\TEST\'
GRANT WRITE, READ ON DIRECTORY TEST TO OTIF_EXECUTOR
0
 
LVL 10

Accepted Solution

by:
SDutta earned 125 total points
ID: 12239348
What Oracle version are you using ?
The size was limited to 1023 bytes upto version 8.0.5
In version 8.1.5 and above, the character size limit is 32767 when you use the max linesize parameter in the UTL_FILE.FOPEN call. It is the 4th parameter.
You should use something like :
lv_file_handle  := UTL_FILE.FOPEN(p_path,REPLACE('test3.xls',' '),'W',5000);

0
 

Author Comment

by:joehodge
ID: 12239400
I have version 9.1 (or 2) so why would I need to declare the size of the bytes?

I'll give it a go.
0
 
LVL 10

Expert Comment

by:SDutta
ID: 12239445
I think the default size is still 1023 bytes but it is OS dependent.

0
 

Author Comment

by:joehodge
ID: 12239490
good work!

I put 5000 and it writes to the file and doesn't lock it.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

809 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