Cannot create a file using  UTL_FILE.FOPEN

Dear All,
I am using this syntax for creating a file in window
i have declare this like this
l_file_id UTL_FILE.file_type;
l_file_name := 'DHL_'||110570284||'_'||TO_CHAR(SYSDATE,'ddmmyyyy')||'.txt'
l_file_id :=UTL_FILE.FOPEN('C:\D2R',l_file_name,'W');
Is this syntax work?
My database version is oralce 10g
Thanks

First of all, UTL_FILE is PL/SQL package and is executed on database server side, not on client side. Therefore, it is trying to create file in directory C:\D2R on database sefrver. So if you want to create file in directory C:\D2R on your client box - you can't. Next point - you are specifying directory explicitly which old and obsolete syntax. It requires, for security reasons to add C:\D2R to init.ora parameter UTL_FILE_DIR, otherwise UTL_FILE will raise an error. You should use directory objects:
CREATE DIRECTORY dir AS 'C:\D2R';and grant READ/WRITE on it to users. Then use:
l_file_id :=UTL_FILE.FOPEN('DIR',l_file_name,'W'); -- use directory name in upper caseAnd keep in mind, as I already mentioned UTL_FILE is PL/SQL package and is executed on database server side which means it runs under OS user oracle. Therefore OS user oracle must have write permission on C:\D2R.
SY.

Similar Messages

  • Unable to create file using : =utl_file.fopen

    Hi Team,
    My issue is file is not getting created, i checked the permissions of the directory.
    No error is received while executing the below script .
    declare
    f1 utl_file.file_type;
    begin
    f1:=utl_file.fopen('TAX_CODE_OUT_FILE_PATH','test.txt','W');
    utl_file.put_line(f1,'memocan');
    utl_file.fclose(f1);
    end;
    Any suggestion why file is not getting created ?

    i tried the following :
    declare
    V1 VARCHAR2(32767);
    f1 utl_file.file_type;
    begin
    F1 := UTL_FILE.FOPEN('TAX_CODE_OUT_FILE_PATH','in.txt','R');
    UTL_FILE.GET_LINE(F1,V1,32767);
    UTL_FILE.FCLOSE(F1);
    end;
    Error is thrown as following ;
    Error report:
    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 537
    ORA-29283: invalid file operation
    ORA-06512: at line 6
    29283. 00000 - "invalid file operation"
    *Cause:    An attempt was made to read from a file or directory that does
    not exist, or file or directory access was denied by the
    operating system.
    *Action:   Verify file and directory access privileges on the file system,
    and if reading, verify that the file exists.
    Any suggestions ??

  • Cannot create pdf files using Pro X

    I am running Mac OS 10.7 (Lion) and just installed Acrobat Pro X and am unable to create ANY pdf files from any type of document. I am also running Office 2011 and Pages for Mac. Every time I click on a document file and try to convert it to pdf I get a message that says "Acrobat could not open the file because it is not a supported file type" These are simple .doc; docx; .xls and pages documents I am trying to create. Straightforward word processing files, nothing more. I am able to convert .jpeg files to pdf with no problem. But there has to be something basic I am doing wrong or some basic setting needs to be changed.
    Any ideas?

    You have to recognize that Acrobat can only convert certain file formats to PDF. And there are less formats that can be converted on the Macintosh than in Windows. In Windows, Acrobat uses an Office plug-in to convert Word, PowerPoint, etc. files. That plug-in is not provided by Adobe for the Macintosh. As to why that is, that's been a subject of ongoing debate for at least a decade.
    Here are the formats you can convert WITHIN Acrobat on the Mac: Image formats (JPEG, TIFF, etc.), EPS, PostScript, Text, HTML.
    So if you want to convert your Word or Pages documents you'll need to use the Macintosh Save as PDF facility. PDF is Mac OS  X's native file format. Keep in mind that you can't expect to do some of the fancier things with Word files made possible by the Windows Office plug-in. You can't save bookmarks, hyperlinks, etc. and expect them to appear in the PDF file.
    You can also use a script that should be installed by default when you install Acrobat Pro X. Instead of choosing Save as PDF (the OS X option), you can choose Save as Adobe PDF. This script (when it works...it seems pretty fragile) uses Distiller in the background to do the conversion. And this script can also not convert Word bookmarks or hyperlinks.

  • Cannot create PDF files using Excel

    I'm using Acrobat PDFMaker 5.0 for Excel to convert my invoices into PDF files to send to clients but for some unknown reason it has just suddenly stopped working. It starts the conversion process OK but then freezes and just hangs. I can continue using my PC but the CPU usage shows as 100%. I end up either having to cancel the conversion or close the programme completely using task manager.
    I'm afraid I'm not very computer savvy, but I really need to find a solution to this problem asap.
    Please can anybody help me?
    Thanks.

    Make sure you've updated your Acrobat 5 to 5.0.5: http://www.adobe.com/support/downloads/detail.jsp?ftpID=1309
    You may also want to confirm whether or not this is document specific.  Does a new Excel file with just a few letters typed into cell A1 convert fine?  If so, you may want to uncheck the 'Enable text and reflow in tagged PDF' option within the PDFMaker preferences.  I may have skewed that verbiage slightly as I haven't looked at Acrobat 5 in a VERY long time, but I recall that option sometimes causing Word and Excel conversions to hang.
    -David

  • To read text file using utl_file

    I would like to read test_file_out.txt which is in c:\temp folder.
    create or replace create or replace directory dir_temp as 'c:\temp';
    grant read, write on directory dir_temp to system;
    then when i execute the below code i get the error .
    // to read text file using utl_file
    DECLARE
    FileIn UTL_FILE.FILE_TYPE;
    v_sql VARCHAR2 (1000);
    BEGIN
    FileIn := UTL_FILE.FOPEN ('DIR_TEMP', 'test_file_out.txt', 'R');
    UTL_FILE.PUT_LINE (FileIn, v_sql);
    dbms_output.put_line(v_sql);
    UTL_FILE.FCLOSE (FileIn);
    END;
    ERROR:
    invalid file operation
    i would like to use ult_file only and also can you let me know to read the text file and place its contents in tmp_emp table?

    Are you trying to read the contents of the file into the local variable? Or write the contents of the local variable to the file?
    Your text talks about reading the file. And you open the file in read mode. But then you call the UTL_FILE.PUT_LINE method which, as SomeoneElse points out, attempts to write data to the file. Since the file is open in read-only mode, you cannot write to the file.
    If the goal is really to read from the file, replace the UTL_FILE.PUT_LINE calls with UTL_FILE.GET_LINE. If the goal is really to write to the file, you'll need to open the file in write mode ('W' rather than 'R' in the FOPEN call).
    Justin

  • Issue while accessing a file using UTL_FILE

    Hi,
    My requirement is to check for the existence of a file in the file system(apps tier) and then launch a conc program to load the data.
    There is a separate DB tier.
    I am trying to use UTL_FILE.fopen to indirectly see if the file exists
    and then proceed and I am trying to use UTL_FILE.fopen for that.
    The file is placed in the apps tier. I have created a directory in the database with the path and using that in the UTL_FILE.FOPEN call.
    However I am getting the following error. ORA-29283 - An attempt was made to read from a file or directory that does not exist, or file or directory access was denied by the operating system.
    What could be the issue here? Is there anything that I need to do after creating the directory?.
    Thanks,
    Balaji

    /Pl post details of OS, database and EBS versions.
    Are the Apps and DB servers physically separate ? If so, the directory on the Apps server where the file resides will have to be visible/updateable to the DB server in order for UTL_FILE to be able to read/write to it.
    HTH
    Srini/
    The apps and db servers are separate. EBS version is 11.5.10.2 and the OS is unix.
    How do I make the directory in apps server visible/updateable to the DB server?. I have created a directory in the database with the location of the file in apps tier.
    Thanks for your quick reply
    Regards
    Balaji

  • Can't read text file using UTL_FILE

    Hi All,
    how can I read notepad file using UTL_FILE package.I have specified the UTL_FILE_DIR in the init.ora file.My objective is to when a button is clicked, the contents of the file will display in a text item.Here is my code written in WHEN_BUTTON_PRESSED trigger.
    DECLARE
         file_handle UTL_FILE.FILE_TYPE;
    data_line Varchar2(100);
    BEGIN
         file_handle := UTL_FILE.FOPEN('E:\vimal','abc.txt','R');
              message('directory created');
         UTL_FILE.GET_LINE(file_handle, data_line);
         :block2.t1 := data_line;
         UTL_FILE.FCLOSE(file_handle);
    END;

    Why don't you use text_io? Don't forget that UTL_FILE is reading directories from the database point of view. The E drive for the database is a different E then on your client pc. I presume your database is on a different computer. Are you getting any errors?

  • Creating new file using report generation express vi

    Hello,
    In my application, I need to write certain data in excel sheet. For that I created an excel template and I used the express vi in report generation toolkit to save the appropriate data in appropritate columns. I need a new file created everyday by that day's name and write the data to it rest of the day. I am having problems creating new file using this express vi. I tried using the low level vi's but not been able to it properly.
    Attaching my code and excel template.
    Please help.
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    excel write2.vi ‏119 KB
    Book2111.xltx ‏8 KB

    r_te wrote:
    The thing is everyday there cannot be a file provided.
    Sure there can.  Don't you see the input on the Express VI for a file? "Path To Save Report" is the name of the input you want.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Application cannot create needed files

    I have searched under this heading but Firefox brought up 1000 articles and I gave up after going through 10 pages, as none seemed relevant.
    I was trying to open my GIO "Virtual Safe" file, which allows me to list all my contents for insurance purposes, by where they are in the house and what category they fall into, and includes costs and photos, and also totals all entries to a final figure. I am sorry but I am not sure what type of file or program it is, but hopefully someone who sees this question will know "Virtual Safe". Anyway, I got a pop-up - "This application cannot start as it cannot create needed files. There may not be enough free disc space".
    I don't see how the last sentence can apply, as I am only using about 140 GB on a 1 TB disc. Also, subsequent checks (see after this) make me question whether the problem is related to the Virtual Safe program at all.
    A short time after this problem surfaced I received a pop-up to say that there was an update to Apache Open Office, which I downloaded. When I tried to open the application file to update Open Office I got a pop-up - "Error! Can't initialize plug-ins directory. Please try again later". I then searched and found the Mozilla help file "Re-initiallizing the plugins database", and other files as well, and followed their instructions. Firstly I changed all my plugins to "Never Activate" as suggested, but it made no difference. So I changed them all back to "Always activate".
    I then deleted the pluginreg.dat file as suggested, but it made no difference, so I reinstated that.
    By this time I began to wonder whether I would be able to open any application file, so out of interest I tried to open a few more application files from my downloads. None would open and I got various pop-up messages when I tried. For some reason they weren't all the same.
    i.e. "Can not create temp folder archive"; and "Failed to download file"; and ""Setup was unable to create the directory "C:\Users\owner\AppData\Local\Temp\is-TTSU7.tmp". Error 5: Access is denied"".
    Can anyone help me?
    Thanks,
    Barry

    hey barry, when you google that error message, it seems to appear for all kinds of different software & it appears that it is caused by something corrupting the system environment. you might want to try the tip here: http://www.windowsbbs.com/windows-7/106826-adobe-reader-wont-install-windows-7-64-bit.html#post618612 or starting the system in safemode and scanning for malware. but again, any more detailed help regarding this issue is probably outside the scope of this forum :-/

  • Cannot create PS file and PDF in Framemaker 9

    I'm using Version 9.0p196.
    When I used the "Advanced Save" to save an .fm file to a pdf, I got the message "The specified printer 'N/A' cannot be found, use printer 'Adobe PDF' instead. After I click OK, it said "cannot create PS file", and "failed to create PDF file.
    It worked fine before.This problem was occurred after I copied some fonts to the following locations:
    C:\Windows\Fonts
    and
    C:\Program Files\Adobe\FrameMaker9\fminit\fonts\adobe
    Those fonts are:
    timesbd.ttf
    times.ttf
    HelveticaWorld-Regular.ttf
    HelveticaWorld-Italic.ttf
    HelveticaWorld-BoldItalic.ttf
    HelveticaWorld-Bold.ttf
    I have no idea if that's the cause of the problem. Does anyone know?
    By the way, the FM 9 is running on XP.
    Thanks,
    Meggie

    Meggie,
    You may or may not have created a mess with fonts. I would try not to have duplicate fonts, it is totally sufficient to have them in C:\Windows\Fonts.
    But your FrameMaker verson is definitely four (4) patches behind. The current version is 9.0.4 (9.0p255) and you can get the updaters here:
    http://www.adobe.com/support/downloads/product.jsp?product=22&platform=Windows
    You have to install them one after another.
    Some of the patches improved the Save as PDF feature.
    For further communication, please add your OS version and Acrobat version.
    - Michael

  • How to read HTML files using UTL_FILE

    Hello Friends,
    How to read HTML files using UTL_FILE package ? According
    to Oracle documentation UTL_FILE can read or write OS Text Files.
    Thanx in advance..
    Adi

    HI Hareesh,
    i have gone through that blog.
    i tried it...but i am getting mapping error  no receiver determination fond because there are so  many excel files.
    my data is available on sharedString.xml but also it is in not same order.
    i have no clue how to handle this part form the blog.
    "This way our mapping will receive all data from the sheet in an XML format. The only thing that's left is to create an XSD file from the XML file we received in order to be able to use it in the mapping and as our Service Interface and we can proceed with mapping. As you can see from the sheet.xml files all the data is placed with column name and row number so it's not that difficult to map it to an table type format using the Message Mapping only (no java, abap mapping required)."

  • Cannot create a file when that file already exists, but should overwrite

    Hi,
    I need the same file name which is at Sender side and when it reaches to Receiver directory without timestamp.
    for eg., Sender side : Yeswanth.txt
    and also receiver side   :  Yeswanth.txt
    but, here it should overwrite the existing file (because, the sender side file name is always constant) at receiver directory when the job schedules for each time.
    Processing parameters i has given on Receiver side:
    File Construction Mode  :  Create
    put file  : Use Temporary File
    and I enabled the Adapter Specific Message Attributes at Sender side and Receiver side.
    Error getting receiver side at communication channel :
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException:
    Yeswanth.txt: Cannot create a file when that file already exists. : com.sap.aii.adapter.file.ftp.FTPEx: 550
    Yeswanth.txt: Cannot create a file when that file already exists.
    Reward points for useful answers.
    Regards,
    Yeswanth.
    Edited by: YeswanthRaj Kumar on May 23, 2008 8:20 AM

    Hi Yeswanth
    Then you can try with a "Add Counter". This will create new file each time with the same name but a counter will be added to the file name at the end specifying the number of times it is created.
    You can also the specify the format to create the counter once select this option u can correspondingly fill the Format and step fields.
    Will this be fine.
    Regards
    Ashmi

  • FTPEx: 550  : Cannot create a file when that file already exists.

    Hi experts,
    I am working on idoc to file scenario and PI 7.1. The idoc is split into 3 files.
    In sxmb_moni , the message is successful , but in rwb( Message montoring) i am geeting the fllowing  Error message.
    ' Delivering the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: An error occurred while connecting to the FTP server '172.19.125.190:21'. The FTP server returned the following error message: 'com.sap.aii.adapter.file.ftp.FTPEx: 550 /Storedata/Outbound/0000001802: Cannot create a file when that file already exists. '. For details, contact your FTP server vendor..'
    and this error message is not displayed for all the target files , some files are getting created succesfully.
    After some times , the file in error status , gets created automatically.
    What may be the reason.?
    Thanks in advance .
    Best Regards,
    Anil

    There seem to be already some files in your Target Directory with the same name as your new files (which the CC is trying to place) and the CC is not able to overwrite the existing files and hence the error...check this.
    Check: http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/69d7cfa4b633eae10000000a1553f6/content.htm
    14.      Select the File Construction Mode.
    u25CB       Create
    The file is created. The document received last is saved in each case.
    If you want the created file to be overwritten, select Overwrite Existing File. If you do not set the indicator, processing is stopped until the created file is processed.
    You can only set the indicator if you select Use Temporary File under Put File below.
    Regards,
    Abhishek.
    Edited by: abhishek salvi on Jul 28, 2009 6:59 PM

  • Cannot rename DC, "Cannot create a file when that file already exists."

    Hi,
    A long time ago we used a domain controller named jacob.mydomain.lan.  It was removed, possibly in a 'dirty' way, and now we cannot re-use that name for another domain controller.  In the meantime we have upgraded to Win 2012 domain controllers
    now, and when I enter this to rename:
    netdom computername ourdc.mydomain.lan /add:jacob.mydomain.lan
    I get the error:  "Unable to add jacob.mydomain.lan as an alternate name for the computer.  The error is:  Cannot create a file when that file already exists."
    If I enter: 
    netdom computername ourdc.mydomain.lan /remove:jacob.mydomain.lan
    I get: "The command completed successfully", but it still refuses to add jacob.mydomain.lan
    After each attempt to add a forward zone dns record 'jacob.ourdomain.lan' has been created.  I always erase this manually afterwards.
    What is the problem? How can I search to find the offending 'file' named 'jacob'?
    Thanks a lot for help on this.
    regards Tor

    Kevin,
    I suggest you wait 30 days instead of 3 days before you enthusiastically close threads. Some people might think you are being a jerk if you don't.
    "K_evin Zhu" wrote in message
    news:[email protected]...
    Hi,
    As this thread has been quiet for a while, we will mark it as �??Answered�?? as the information provided should be helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up. You can also choose to
    unmark the answer as you wish.
    BTW, we�??d love to hear your feedback about the solution. By sharing your experience you can help other community members facing similar problems. Thanks for your understanding and efforts.
    Best Regards
    Kevin
    Tomás Mason

  • Im using xcode 4.6 and im having problems reading files using the fopen function in c

    Im using xcode 4.6 and im having problems reading files using the fopen function in c

    Yes, but that would not cause the "build  failed" message.
    right I missed that part. Looks like two problems then.
    //  main.m
    //  ASCTestFopen
    //  Created by Frank Caggiano on 3/2/13.
    //  Copyright (c) 2013 Frank Caggiano. All rights reserved.
    #import <Foundation/Foundation.h>
    #include <stdio.h> 
    int main(int argc, const char * argv[])
        @autoreleasepool {
            FILE *fp, *fopen();
            // insert code here...
            if((fp = fopen("~/test.txt","r")) == NULL)
                NSLog(@"open failed");
        return 0;
    This will compile ad run in Xcode with a project type of comand line tool

Maybe you are looking for

  • Import job RSI_IMPORT_CCMS_JOBS is not working in Redwood Cronacle

    Hi, We are facing problems in the redwood cronacle, where in the standard import job RSI_IMPORT_CCMS_JOBS is not working. When ever we are running the script, the status of the import job goes to waiting and never gets completed. When its killed and

  • ALV dynamic with deep structure

    Hi All, I need to program an ALV Report with a deep structure based on a outbound proxy  structure, so I should pass to ALV function or ALV Method a dynamic table and a dynamic structure. I tried to do it but I got a dump using this function module R

  • How do I change track names manually?

    How do I change track names manually?

  • Enhancement Set error in AAK

    Hello Experts,, We are trying to follw the steps given in the AAK Standard Documentation. We have created the Change Piece List Delivery Package and When we are doing the Object List check - We are getting the following error for enhancement set tabl

  • Replacing my g5 with imac, logic

    my intro to daw was garage band, this was also my intro to apple. since ive moved to a power pc and logic, ive kept up on all updates and currently run logic 9. My power pc g5 reponds with less speed than my newer macbook.....so im going to buy a new