Solved

ORA-29285: file write error

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
querying by the sum of a column in decimal 7 56
case statement in where clause 5 40
Queries 15 34
Use of Exception to end a Loop 3 14
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
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 how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

919 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

14 Experts available now in Live!

Get 1:1 Help Now