Solved

ORA-29285: file write error

Posted on 2004-10-06
5
4,031 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
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 explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now