Solved

ORA-29285: file write error

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
null value 15 99
ORA-12560: TNS:protocol adapter error 8 126
How to connect SQL Server from my Oracle database? 11 93
'G_F01' is not a procedure or is undefined 3 23
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

816 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

11 Experts available now in Live!

Get 1:1 Help Now