Samples using UTL_FILE package

hello;
I would like to use the utl_file package: fopen, put_line ...
can you send me some samples using this package.
thanks to your help
mam
null

declare
T1 UTL_FILE.FILE_TYPE;
begin
begin
T1:= UTL_FILE.FOPEN
('/u02/applmgr/10.7p161/eye/3.3.1/out','filename.dat','w');
EXCEPTION
WHEN UTL_FILE.INVALID_PATH THEN
DBMS_OUTPUT.PUT_LINE('Invalid Path');
WHEN UTL_FILE.INVALID_MODE THEN
DBMS_OUTPUT.PUT_LINE('Invalid Mode');
WHEN UTL_FILE.INVALID_OPERATION THEN
DBMS_OUTPUT.PUT_LINE('Invalid Operation');
end;
UTL_FILE.PUT(T1,'PROD DATE ');
UTL_FILE.PUT(T1,'PRODUCT ');
UTL_FILE.PUT_LINE(T1,'INTEREST TYPE ');
UTL_FILE.PUT(T1,'LEASE NUMBER ');
begin
UTL_FILE.FCLOSE(T1);
EXCEPTION
WHEN UTL_FILE.WRITE_ERROR THEN
DBMS_OUTPUT.PUT_LINE('write error');
WHEN UTL_FILE.INVALID_FILEHANDLE THEN
DBMS_OUTPUT.PUT_LINE('Invald File Handle');
end;
END;
mamoudou (guest) wrote:
: hello;
: I would like to use the utl_file package: fopen, put_line ...
: can you send me some samples using this package.
: thanks to your help
: mam
null

Similar Messages

  • Error while using UTL_FILE package

    I am getting error while using UTL_FILE package in apex 3.0 version
    Pls help me out.

    ok, how are you using UTL_FILE and what is the error?

  • Need to generate the excel file with diffrent sheets using utl_file package

    Hi,
    Sorry for previous message in which I had missed the usage of " UTL_FILE " package
    I need to generate the excel file with diffrent sheets . Currently I am generating the data in three diffrent excel files using
    " UTL_File " package and my requirement is to generate this in a single excel file with diffrent sheets.
    Please help on this
    Thanks & Regards,
    Krishna Vyavahare

    Hello 10866107,
    at Re: How to save a query result and export it to, say excell? you can find links to different solutions. At least the packages behind second and fourth link support more than one worksheet.
    Regards
    Marcus

  • Permissions on files created using UTL_FILE package

    The files created on unix using UTL_FILE package have permisisons rw- - - - - - -.(600). I want them to be created with permissions 640.(rw-r - - - - - ).i.e read access to the group also. The umask setting of the unix account of the oracle instance are 137. Is there any way to create the files with the required permissions.

    So SQL*Plus is on your PC? I'm assuming you mean 'call' as in the windows cmd.exe command?
    Sheesh this is like getting blood from a stone.
    In that case you must be connecting via the listener and not internally.
    In which case the umask comes from the umask that was set in the environment of the OS user who started the listener process.
    Thats not necessarily the same as the owner of the oracle software (normally 'oracle').
    If sysdamin joebloggs logs in and starts the listener manually in a shell, then the umask applied to all shadow processes started by the listener is whatever jobloggs umask was when he typed the command 'lsnrctl start'. The umask of the owner of the oracle software, or your umask, is utterly irrelevent.
    So if you don't like the umask for files created by processes spawned by the listener, stop and restart the listener in a shell where you have explicitly set the umask to what you want it to be.
    Really starting the listener should be scripted and the correct umask is put in the script just before the call to 'lsnrctl start'.

  • Creating Error log files using UTL_FILE package on a remote machine

    Database Version: 10g Release2
    OS Platform: Sun Solaris
    I have been asked to log errors to OS files rather than tables. So, i wanted to use UTL_FILE package. But the client doesn't want to store these files on the same server where the database is running(as specified in UTL_FILE_DIR). Is there a way i could get these files created on a remote machine(client).

    I believe what others are suggesting is that your stored procedure continues to log to a table and a separate process be created that runs on the machine you want the file to be created on which reads the log table and writes to a log file.
    If that is not an option, can you expose the directory on the remote machine you want to write the file to as a file share that can be mounted by the database server? If you can, you could write errors there using UTL_FILE. However, it would probably be a bad idea. If you're logging an error already, that implies that something has gone wrong. Making an error logging process dependent on a remote server being available and properly mounted with appropriate privileges at the instant the error occurs just creates more sources of failure that would prevent you from logging an error, which would prevent you from being able to debug the problem or even know it existed without a report from a user.
    Justin

  • Archiving files generated by PL/SQL program using UTL_FILE package

    Dear All,
    We have on PL/SQL package that is generating some data files using UTL_FILE package in one specific directory.
    I am working on concurrent program of type host(unix script) to move generated file to some archive folder.
    Now the problem is owner of the files generated by PL/SQL is oracle and file permissions of the generated files are 644(Only read permission for group and others).
    Concurrent program is using an another os user applmgr to execute the script attached with concurrent program.
    Because applmgr is not having write permission on the files, hence mv command is failing.
    Please suggest me how to resolve this issue.
    Regards
    Devender Yadav

    Hi;
    I just think that, you can create one sh which is chancing permission of related path owner for applmgr user and put it on crontab and it can run every 1 min.
    Regard
    Helios

  • Create a file and store it in the database using UTL_FILE package

    Hello.
    I'm using UTL_FILE package to store data from a table into an excel file but I don't know how to store this file in a table with a BLOB field the database at the same time. I want do do this because I will use it in a Oracle Portal.
    Anybody has any idea how to do this?
    Thanks & Regards,
    Alexandra

    From Asktom
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:232814159006

  • Writing files using UTL_FILE package

    Greetings:
    I'm attempting to write simple text files on the server side using the UTL_FILE package.I can get it to write the file to a local drive on the Oracle server with no problems, but not a network drive. When trying to write to a network drive, the FOPEN function raises the UTL_FILE.INVALID_OPERATION exception. This is even with my UTL_FILE_DIR parameter set the * for all directories and I have "Full Control" permission on the directory. I am running in a NT Server/Wkstn environment. Anyone have any ideas why I can't write a file to a network drive?
    Thanks a lot,
    Chris Scopp

    Thanks for your response...
    I have set the UTL_FILE_DIR parameter... I've tried setting it to the * for all directories and also mapping a drive letter from the server to where I want to write the file and then explicitly naming this path in the UTL_FILE_DIR parameter. Neither works, I still get the INVALID_OPERATION exception raised on the FOPEN function. I'm convinced now that it does have something to do with NT because I have been able to do the same operation writing to a Win95/98 box and it works fine. I have "Full Control" to all places I'm trying to write to, any other ideas?
    Thanks a lot,
    Chris Scopp

  • Reading all files on directory using "utl_file" package...

    I need to read all files in directory via PL/SQL. I don't know
    name files (are data dynamics create for automation system),
    only I know your extensions.
    Can I do this using the package "utl_file" or I need to create
    program in another language (C, C++, for example)?
    Any ideas...
    Thanks.

    Hi,
    you can't do that with the UTL_FILE package (it can't retrieve
    file names).
    A very simple solution would be, if you created on OS-level a
    file which contains the filenames of directory and then read this
    file using UTL_FILE. With the information on all file names you
    can enter a loop which opens and reads all files again using
    UTL_FILE.
    A more mundane solution could be to use the features on the iFS.
    Cheers
    Gerald

  • Unable to write files in different m/c in LAN using utl_file package

    I need to dump some files generated by utl_file package in a separate m/c not in the db server.For that I tried using utl_file_dir='*' and mapped the specified directory in the db server. but its failing as show below..
    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 449
    ORA-29283: invalid file operation
    ORA-06512: at "ANIRBAN.WRITE_IN_FILE", line 9
    ORA-06512: at line 1
    The prototype sp is given below..
    CREATE OR REPLACE PROCEDURE write_in_file(pInDir IN VARCHAR2,
    pInFileName IN VARCHAR2,
    pInFileContent IN VARCHAR2) IS
    vFile UTL_FILE.FILE_TYPE;
    vFileName VARCHAR2(20) := pInFileName;
    BEGIN
    dbms_output.enable(1000000);
    vFile := UTL_FILE.FOPEN(pInDir, vFileName, 'w', 32000);
    UTL_FILE.PUT_LINE(vFile, pInFileContent);
    UTL_FILE.FCLOSE(vFile);
    END write_in_file;
    With this sp i'm able to write in genuine drives but not in mapped one.What shall be done to be able to write in a separate m/c freely.Plz guide me

    And make sure you specify the full path name of the server/directory path rather than using substituted drive names as is can sometimes be funny about that sort of thing.

  • Having problem in recognising file using utl_file package..

    Hi,
    I am using utl_file utility to read the CSV file, utl_file.fopen function is useed to open file. This fopen function has three input parameters, second parameter is file name. My problem is that, i have to read file on daily basis. File name will be like:- DDMMYYYYHHMISS. Last six characters are for hour minute second of the file generation time. If the name has only DDMMYYYY then I can give the file name like TO_CHAR(SYADATE,'DDMMYYYY'), because on a particular date its same for the whole day. But hours, minutes and seconds will be of the time when the file is generated, it may be different for different days. In this condition how can I standardize the value for file name parameter in fopen function.
    Thanks in advance.

    Bharat Kaushik wrote:
    Actually.....
    I am gettting file from some other place..... And those people are not agreed to send file without exact time.JAVA solution is here
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:7506780031005
    Or if you want PL/SQL .. (May Be kiddy)
    --Please Note: SYSDATE is 26th in our DB.
    SQL> declare
      2   fp utl_file.file_type;
      3   dt date := trunc(sysdate);
      4  begin
      5   while (dt <= sysdate) loop
      6    begin
      7      fp := utl_file.fopen('OGL_REPORT_ACCESS','TEST'||to_char(dt,'ddmmyyyyhh24miss')||'.csv','r');
      8      dbms_output.put_line('TEST'||to_char(dt,'ddmmyyyyhh24miss'));
      9      utl_file.fclose(fp);
    10      exit;
    11    exception
    12     when utl_file.INVALID_OPERATION then
    13      null;
    14    end;
    15    dt := dt + 1/24/60/60;
    16   end loop;
    17  end;
    18  /
    TEST26042009010102
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:03.45
    SQL> select sysdate from dual;
    SYSDATE
    26-APR-09

  • Runtime error using utl_file package

    Hi Friends,
    This is the procedure for reading sample data from flat file , but it won't work.
    create or replace procedure test_utl_file
    is
    ftype utl_file.file_type;
    ch varchar2(200);
    begin
    ftype := utl_file.FOPEN('C:\oracle\temp','data.txt,R');
    utl_file.get_line(ftype,ch);
    dbms_output.put_line(ch);
    end;
    This code is compiled succesfully , but at runtime it shows an error msg
    ORA-29280: invalid directory path
    ORA-06512: at "SYS.UTL_FILE", line 33
    ORA-06512: at "SYS.UTL_FILE", line 436
    ORA-06512: at "SCOTT.TEST_UTL_FILE", line 7
    ORA-06512: at line 1
    I had entered the directory entry in int.ora file
    utl_file_dir=C:\oracle\temp
    & i used another way also,
    by using alter set utl_file_dir=C:\oracle\temp scope=spfile;
    Can anyone help me to resolve this problem.
    Rgrds,
    Anand

    What database version are you using?
    The UTL_FILE_DIR parameter has been deprecated by oracle in favour of direcory objects because of it's security problems.
    The correct thing to do is to create a directory object e.g.:
    CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';
    Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
    Then, grant permission to the users who require access e.g....
    GRANT READ,WRITE ON DIRECTORY mydir TO myuser;
    Then use that directory object inside your FOPEN statement e.g.
    fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');
    Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default.

  • Using UTL_FILE package

    Dear Oracle community,
    Oracle has a great feature for letting your PL/SQL programs read and write operating system (OS) text files. However, there are no samples available.
    Does anyone already explored this feature and are willing to share some examples?
    Your help would be great. Thanks.
    Faron Sibbald

    Hi here is sample code I wrote to split up a 2 giga byte file so that it can be easily loaded using in wordpad/notepad or excell. Note you can also do lot of error traping. Its documented in oracle PL/SQL.
    CREATE OR REPLACE PROCEDURE mytest7 IS
    infile UTL_FILE.file_type;
    outfile UTL_FILE.file_type;
    filein varchar2(25);
    fileout varchar2(25);
    cur_dir varchar2(25);
    in_linebuf varchar2(301);
    out_linebuf varchar2(301);
    rec_count Number;
    cuml_rec_count Number;
    file_num Number;
    BEGIN
    rec_count := 0;
    cuml_rec_count := 0;
    file_num := 1;
    cur_dir := 'c:\junk\';
    filein := 'c:\junk\mluinput.txt';
    fileout := 'c:\junk\output'&#0124; &#0124; file_num &#0124; &#0124;'.txt';
    infile := UTL_FILE.fopen(cur_dir,filein,'R');
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 63670
    THEN
    rec_count := cuml_rec_count;
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    Exit;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 127340
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 191010
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 254680
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 318350
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 382020
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf ;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 445690
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 509360
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count > 573030
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    rec_count := 0;
    file_num := file_num + 1;
    fileout := 'output'&#0124; &#0124; file_num &#0124; &#0124; '.txt';
    outfile := UTL_FILE.fopen(cur_dir,fileout,'W');
    LOOP
    IF cuml_rec_count = 636698
    THEN
    out_linebuf := 'Total Records in this file = ' &#0124; &#0124; TO_CHAR(rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    out_linebuf := 'Total Cumulative Records = ' &#0124; &#0124; TO_CHAR(cuml_rec_count);
    UTL_FILE.put_line(outfile,out_linebuf);
    UTL_FILE.fclose(outfile);
    EXIT;
    ELSE
    UTL_FILE.get_line(infile,in_linebuf);
    cuml_rec_count := cuml_rec_count + 1;
    rec_count := rec_count + 1;
    out_linebuf := in_linebuf;
    UTL_FILE.put_line(outfile,out_linebuf);
    END IF;
    END LOOP;
    UTL_FILE.fclose_all;
    END mytest7;
    show errors

  • Problem Using UTL_FILE package ORA-29285

    Dear All,
    I would very much appreciate your help.
    I am trying to export data form a table.
    The version of the DB is 10.2.0.4
    I am using the following procedure:
    create or replace
    procedure EXPORT_FRAME(
    dir IN VARCHAR2, filename IN VARCHAR2) IS
    f utl_file.file_type;
      cursor frame is
        Select *
        from test_complete_frame_2008;
    begin
      f:= utl_file.fopen (dir, filename,'w');
      FOR a IN frame
      Loop
        utl_file.put_line (f,
            '"'||a.COM_DATA_ID || '";"' ||
               a.COM_DATA_SET_ID || '";"'||
                a.NSI || '";"'||
                a.FRAME_ID || '";"'||
                a.STATUS_FRAME || '";"'||
                TO_CHAR(a.FRAME_REFERENCE_DATE, 'dd/mm/yyyy') || '";"'||
                TO_CHAR(a.DATE_OF_SELECTION, 'dd/mm/yyyy')  || '";'||
                a.EU_LEU_ID || ';"'||
                a.NSA_ID || '";"'||
                a.SOURCE_IDENTITY || '";"'||
                TO_CHAR(a.REF_DATE_LEU_IDENTITY, 'dd/mm/yyyy') || '";"'||
                a.NATIONAL_ID || '";"'||
                a.REF_DATE_NATIONAL_ID || '";"'||
                a.DUNS_NUMBER || '";"'||
                TO_CHAR(a.REF_DATE_DUNS_NUMBER, 'dd/mm/yyyy') || '";"'||
                a.BVD_ID || '";"'||
                TO_CHAR(a.REF_DATE_BVD_ID, 'dd/mm/yyyy') || '";"'||
                a.NAME_LEGAL_UNIT || '";"'||
                a.LEGAL_FORM_EGR || '";"'||
                a.SOURCE_LEGAL_FORM || '";"'||
                TO_CHAR(a.REF_DATE_LEGAL_FORM, 'dd/mm/yyyy') || '";"'||
                a.TYPE_OF_LEGAL_UNIT || '";"'||
                a.SOURCE_CODE_TYPE_OF_LEU || '";"'||
                TO_CHAR(a.REF_DATE_TYPE_OF_LEU, 'dd/mm/yyyy') || '";"'||
                a.STATUS_LEU || '";"'||
                a.SOURCE_CODE_STATUS_LEU || '";"'||
                TO_CHAR(a.REF_DATE_STATUS_LEU, 'dd/mm/yyyy') || '";"'||
                a.POST_DELIVERY_POINT || '";"'||
                a.CITY_NAME || '";"'||
                a.POSTAL_CODE || '";"'||
                a.STATE_NAME || '";"'||
                a.COUNTRY_CODE_BOP || '";"'||
                a.COUNTRY_ACCESS_CODE || '";"'||
                a.TELEPHONE_NUMBER || '";"'||
                a.FAX_NUMBER || '";"'||
                TO_CHAR(a.DATE_OF_INCORPORATE, 'dd/mm/yyyy') || '";"'||
                a.SOURCE_DATE_OF_INCORP || '";"'||
                TO_CHAR(a.REF_DATE_DATE_OF_INCORP, 'dd/mm/yyyy') || '";"'||
                TO_CHAR(a.DATE_OF_LIQUIDATION, 'dd/mm/yyyy') || '";"'||
                a.SOURCE_DATE_OF_LIQ || '";"'||
                TO_CHAR(a.REF_DATE_DATE_OF_LIQ, 'dd/mm/yyyy') || '";"'||
                a.NACE_CODE || '";"'||
                a.VERSION_NACE || '";"'||
                a.SOURCE_CODE_NACE || '";"'||
                TO_CHAR(a.REF_DATE_NACE, 'dd/mm/yyyy') || '";"'||
                a.NUMBER_PERS_EMPLOYED || '";"'||
                a.SOURCE_CODE_PERS_EMPL || '";"'||
                a.CONS_PERSON_EMPLOYED || '";"'||
                TO_CHAR(a.REF_DATE_PERS_EMPLOYED, 'dd/mm/yyyy') || '";"'||
                a.SPECIAL_PURP_ENTITY_CODE || '";"'||
                a.SOURCE_CODE_SPE || '";"'||
                TO_CHAR(a.REF_DATE_SPE_CODE, 'dd/mm/yyyy') || '";"'||
                a.EMAIL_ADDRESS || '";"'||
                TO_CHAR(a.REF_DATE_EMAIL_ADDRESS, 'dd/mm/yyyy') || '";"'||
                a.WEB_ADDRESS || '";"'||
                TO_CHAR(a.REF_DATE_WEB_ADDRESS, 'dd/mm/yyyy') || '";"'||
                a.P_EU_LEU_ID || '";"'||
                a.P_NAME_LEGAL_UNIT || '";"'||
                a.P_COUNTRY_CODE_BOP || '";"'||
                a.STATUS_RELATIONSHIP || '";"'||
                a.PERCENTAGE || '";"'||
                a.KIND_OF_CONTROL || '";"'||
                a.SOURCE_CODE_RELATIONSHIP || '";"'||
                TO_CHAR(a.REF_DATE_RELATIONSHIP, 'dd/mm/yyyy') || '";"'||
                a.GLOBAL_LEVEL || '";"'||
                a.GGH_EU_LEU_ID || '";"'||
                a.GGH_NAME_LEGAL_UNIT || '";"'||
                a.GGH_COUNTRY_CODE_BOP || '";"'||
                a.GGH_NSA_ID || '";"'||
                a.GGH_DUNS_NUMBER || '";"'||
                a.GGH_BVD_ID || '";"'||
                a.GGH_SOURCE_IDENTITY || '";"'||
                a.GLOBAL_EG_ID || '";"'||
                a.GLOBAL_EG_NAME || '";"'||
                a.TOP_MNE_IND || '";"'||
                a.GEG_PERSONS_EMPLOYED || '";"'||
                a.GEG_SOURCE_CODE_PERS_EMPL || '";"'||
                TO_CHAR(a.GEG_REF_DATE_PERS_EMPL, 'dd/mm/yyyy') || '";"'||
                a.NUMBER_OF_LEGAL_UNITS || '";"'||
                a.GEG_NACE_CODE_DIV || '";"'||
                a.GEG_SOURCE_CODE_NACE || '";"'||
                TO_CHAR(a.GEG_REF_DATE_NACE, 'dd/mm/yyyy') || '";"'||
                a.GEG_CONS_TURNOVER || '";"'||
                a.GEG_VALUTA_CONS_TURNOVER || '";"'||
                TO_CHAR(a.GEG_BEGIN_CONS_TURNOVER, 'dd/mm/yyyy') || '";"'||
                TO_CHAR(a.GEG_END_CONS_TURNOVER, 'dd/mm/yyyy') || '";"'||
                a.GEG_SOURCE_CONS_TURNOVER || '";"'||
                TO_CHAR(a.GEG_REF_DATE_C_TURNOVER, 'dd/mm/yyyy') || '";"'||
                a.GEG_TOTAL_ASSETS || '";"'||
                a.GEG_VALUTA_TOTAL_ASSETS || '";"'||
                a.GEG_SOURCE_TOTAL_ASSETS || '";"'||
                TO_CHAR(a.GEG_REF_DATE_TOTAL_ASSETS, 'dd/mm/yyyy') || '";"'||
                a.GEG_WEB_ADDRESS || '";"'||
                a.GDC_EU_LEU_ID || '";"'||
                a.GDC_NAME_LEGAL_UNIT || '";"'||
                a.GDC_COUNTRY_CODE_BOP || '";"'||
                a.GDC_NSA_ID || '";"'||
                a.GDC_DUNS_NUMBER || '";"'||
                a.GDC_BVD_ID || '";"'||
                a.GDC_SOURCE_IDENTITY || '";"'||
                a.REP_EU_LEU_ID || '";"'||
                a.REP_NAME_LEGAL_UNIT || '";"'||
                a.REP_POST_DELIVERY_POINT || '";"'||
                a.REP_POSTAL_CODE || '";"'||
                a.REP_STATE_NAME || '";"'||
                a.REP_CITY_NAME || '";"'||
                a.REP_COUNTRY_CODE_BOP || '"'
           UTL_FILE.new_line (f);
      END LOOP;
      UTL_FILE.new_line (f);
      UTL_FILE.fclose(f);
        EXCEPTION
          WHEN NO_DATA_FOUND
            THEN dbms_output.put_line ('FAILED');
    END EXPORT_FRAME;I get an error message:
    Error starting at line 1 in command:
    begin EXPORT_FRAME ('EXP','test2.csv'); end;
    Error report:
    ORA-29285: file write error
    ORA-06512: at "SYS.UTL_FILE", line 136
    ORA-06512: at "SYS.UTL_FILE", line 813
    ORA-06512: at "EGR.EXPORT_FRAME", line 13
    ORA-06512: at line 1
    29285. 00000 - "file write error"
    *Cause:    Failed to write to, flush, or close a file.
    *Action:   Verify that the file exists, that it is accessible, and that
    it is open in write or append mode.
    Any idea?
    Thanks in advance!

    By default UTL_FILE.FOPEN opens file with record size up to 1024 characters (including newline). Most likely your code exceeds 1024. Change:
    f:= utl_file.fopen (dir, filename,'w');to something like (assuming none of your records will exceed 10000)
    f:= utl_file.fopen (dir, filename,'w',10000);SY.

  • Problem in using UTL_FILE Package

    Dear Mates,
    I am trying to make use of UTL_FILE for inseting data in to the tables by reading the contents of a text file. I have set the UTL_FILE_DIR parameter by giving the path. Still i am not able to insert the records to the table.
    The error I am getting is
    ERROR at line 1:
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PRASANNA.LOADSTUDENTS", line 61
    ORA-06512: at line 1
    I have set the parameter UTL_FILE_DIR in INIT<SID>.ORA as
    UTL_FILE_DIR=C:\developer
    please help me out
    It will be helpful if you can mail me at [email protected]

    ORA-06512: at "PRASANNA.LOADSTUDENTS", line 61how looks like line 61 in your PRASANNA.LOADSTUDENTS function?
    what's happening there?
    From "Oracle Product Document Library":
    ORA-06512 at string line string
    Cause: Backtrace message as the stack is unwound by unhandled exceptions.
    Action: Fix the problem causing the exception or write an exception handler for this condition. Or you may need to contact your application administrator or database administrator.

Maybe you are looking for

  • Apple unable to unlock replacement unlocked iPhone 4S

    This is especially important to anyone who purchased an unofficial unlocked iPhone 4S in the USA with an AT&T micro-sim rather than the official unlocked iPhone 4S SKU packages (starting on 11/11/11). On Oct 17th I purchased a 32gb iPhone 4S at an Ap

  • Users related-urgent

    How can we know information releated to particular user. My requirement is i would like to know the reports names run by particular user. rgds bharath

  • 6025e MAX test panel

    I'm using MAX test panel to test my digital I/O pins, however i couldn't find any manual explaining the function of the test panel. there are 2 tab on DIO. what are the operation/function in the 2 DIO tab? First Digital IO tab a. which port does it t

  • Can't open iCloud on my PC.

    I enter the correct user ID and password in iCloud on my PC but nothing happens.  It worked just fine a couple of weeks ago, but not now>

  • Quicktime Pro quits on export

    I have used Quicktime Pro without any problems for a while now. However I recently installed Perian so that I could watch flash video within the quicktime player. Now I cannot export any movie content of any format from Quicktime. When I click on the