?
Solved

ORA-29285: file write error

Posted on 2004-10-06
5
Medium Priority
?
4,118 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
[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
  • 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
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 video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

777 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