Create a file using text_io package

Hi my friends,
I would like to direct the output from my Reports to a file.
I was searching in Oracle Forum and I found:
1.in the before report trigger open a file(.txt file) for write mode using text_io.fopen. You can specify the file name with whatever path u want.
2.Whatever fields from the report you want to redirect to the this file, go to the repeating frame of that field and use text_io.put or put_line.
How to I could do this?????
3.Finally , maybe in the after report or whereever close the file you opened using text_io.close.
Someone, could give more information about this?
Thanks...
Carla

Hi Carla
What I understand from your words is that you want to write out a file based on your query in the report using the text_io package.
You could be doing this in the Format Trigger of the appropriate Repeating Frame.
You could also be using Delimited output and choose an appropriate delimiter character.
With Reports 9i, you could be doing File I/O operations using Java calls by importing a Java class.
Hope this helps.
Regards
Sripathy

Similar Messages

  • Creating XML File Using xmldom Package

    How can I create an XML file from scratch using the PL/SQL xmldom package?
    I want to create an XML file using the xmldom package instead of building the individual tags as strings of VARCHAR2 character data. There is quite a bit of documentation regarding manipulating input XML files using DOM -- but not for creating XML files from scratch given known "tagnames" (<lastName>) and retrieved database "values" ("Smith").
    <person>
    <lastName>Smith</lastName>
    </person>
    Is there any documentation that you can recommend?
    Thank you.

    Here is an example.
    The create_file procedure creates the file.
    The other procedures are generic procs that can be used with any XML.
    PROCEDURE create_file_with_root(po_xmldoc OUT xmldom.DOMDocument,
    pi_root_tag IN VARCHAR2,
                                            po_root_element OUT xmldom.domelement,
                                            po_root_node OUT xmldom.domnode,
                                            pi_doctype_url IN VARCHAR2) IS
    xmldoc xmldom.DOMDocument;
    root xmldom.domnode;
    root_node xmldom.domnode;
    root_element xmldom.domelement;
    record_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    xmldom.setDoctype(xmldoc, pi_root_tag, pi_doctype_url,'');
    -- Create the root --
    root := xmldom.makeNode(xmldoc);
    -- Create the root element in the file --
    create_element_and_append(xmldoc, pi_root_tag, root, root_element, root_node);
    po_xmldoc := xmldoc;
    po_root_node := root_node;
    po_root_element := root_element;
    END create_file_with_root;
    PROCEDURE create_element_and_append(pi_xmldoc IN OUT xmldom.DOMDocument,
    pi_element_name IN VARCHAR2,
                                            pi_parent_node IN xmldom.domnode,
                                            po_new_element OUT xmldom.domelement,
                                            po_new_node OUT xmldom.domnode) IS
    element xmldom.domelement;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    element := xmldom.createElement(pi_xmldoc, pi_element_name);
    child_node := xmldom.makeNode(element);
    -- Append the new node to the parent --
    newelenode := xmldom.appendchild(pi_parent_node, child_node);
    po_new_node := child_node;
    po_new_element := element;
    END create_element_and_append;
    FUNCTION create_text_element(pio_xmldoc IN OUT xmldom.DOMDocument, pi_element_name IN VARCHAR2,
    pi_element_data IN VARCHAR2, pi_parent_node IN xmldom.domnode) RETURN xmldom.domnode IS
    parent_node xmldom.domnode;                                   
    child_node xmldom.domnode;
    child_element xmldom.domelement;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    create_element_and_append(pio_xmldoc, pi_element_name, pi_parent_node, child_element, child_node);
    parent_node := child_node;
    -- Create a text node --
    textele := xmldom.createTextNode(pio_xmldoc, pi_element_data);
    child_node := xmldom.makeNode(textele);
    -- Link the text node to the new node --
    compnode := xmldom.appendChild(parent_node, child_node);
    RETURN newelenode;
    END create_text_element;
    PROCEDURE create_file IS
    xmldoc xmldom.DOMDocument;
    root_node xmldom.domnode;
    xml_doctype xmldom.DOMDocumentType;
    root_element xmldom.domelement;
    record_element xmldom.domelement;
    record_node xmldom.domnode;
    parent_node xmldom.domnode;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    create_file_with_root(xmldoc, 'root', root_element, root_node, 'test.dtd');
    xmldom.setAttribute(root_element, 'interface_type', 'EXCHANGE_RATES');
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mr', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'Joe', record_node);
    parent_node := create_text_element(xmldoc,'surname', 'Blogs', record_node);
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mrs', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'A', record_node);
    parent_node := create_text_element(xmldoc, 'surname', 'B', record_node);
    -- write the newly created dom document into the buffer assuming it is less than 32K
    xmldom.writeTofile(xmldoc, 'c:\laiki\willow_data\test.xml');
    EXCEPTION
    WHEN xmldom.INDEX_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Index Size error');
    WHEN xmldom.DOMSTRING_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'String Size error');
    WHEN xmldom.HIERARCHY_REQUEST_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Hierarchy request error');
    WHEN xmldom.WRONG_DOCUMENT_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Wrong doc error');
    WHEN xmldom.INVALID_CHARACTER_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Invalid Char error');
    WHEN xmldom.NO_DATA_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Nod data allowed error');
    WHEN xmldom.NO_MODIFICATION_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'No mod allowed error');
    WHEN xmldom.NOT_FOUND_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not found error');
    WHEN xmldom.NOT_SUPPORTED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not supported error');
    WHEN xmldom.INUSE_ATTRIBUTE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'In use attr error');
    WHEN OTHERS THEN
    dbms_output.put_line('exception occured' || SQLCODE || SUBSTR(SQLERRM, 1, 100));
    END create_file;

  • No ability to create PDF Files using Acrobat 6.01_6.06 after installing Word 2010. (Windows XP)

    Since installing Word 2010 (upgrading from Word 2003) there are no visable PDF Icons nor ability to create PDF Files using Adobe Acrobat 6.06.  Operating system is Windows XP.  Browser is IE8.  Various attempts to bypass this situation have not been successful.  No problems had been experienced earlier using Acrobat 6.01 through 6.06 with Word 2003 and earlier Word versions during the passed 10 years or so.  Adobe's support is not responding to recognize mentioned situations, nor is there any a solution to fix the problem.  Low volume small businesses,with limited need to create PDF files, are being considerably burdened to substante a $200 investment to upgrade to Acrobat X, which may as well not be the solution.  It is appealed for Adobe Forums readers to share similar experiences with possible fixes at hand.  Responses will be greatly appreciated.  Thank you...

    Your response is greatly appreciated, Bernd...
    Unfortunately, those of us who milk software packages for eons such as
    Acrobat 6.06 Standard, a full version of Acrobat X is quoted to be $299
    with no ability to upgrade since 7.0 is the cutoff which remains to be
    only $139.
    It seems to me, Military personal, retired or just ole toots who did
    their think, would offer considerations such as Staples, Lowe's, and
    other big boxes offer.  Such is greed for some who do not consider 
    alternatives above their noses...
    Thank you,
    Skip

  • Finding EOF using TEXT_IO package

    Hi everybody,
    I use TEXT_IO package and read all lines of a text file....
    How can the logic of the routine i write come out of the loop when the file ends..(EOF=TRUE).
    Thanks ,
    Simon

    The TEXT_IO raise a NO_DATA_FOUND when the EOF is reached.
    Francois

  • How do you create *.exe files using Labview6.0

    I shall be grateful if anyone can give me the following info or direct me as to where i can find it..
    (a) What is the procedure of creating executable files using labview6.0
    (b) Do i require any other components other than the labview base package.

    In addition to previous post,
    a) after buying Application Builder (which is included only in LV6i Professional Package), you'll notice a new entry in LV Tools menu (Build Application or Shared Library[DLL]). This opens App Builder (a panel where you can setup many parameters for the VI/LLB to 'build'). It's not complicated and you can use default values for the first try (after selecting your VI)
    b) here is the link to start with App Builder [http://sine.ni.com/apps/we/nioc.vp?lang=US&pc=mn&cid=2448]

  • Can't create a file using fm 'File_Get_Name'

    hi gurus,
    Can you please help me with this issue. There's a program that have to create a file using the said fm. It was working before when it was set in OS NT. But when the settings and codes have been changed to UNIX, the program was able to generate the program. But the file doesn't exist. It seems it  doesn't create a file in that server.
    What else do I need to check?
    Points will be rewarded. Thanks
    Here's the code for your reference:
    CALL FUNCTION 'FILE_GET_NAME'
           EXPORTING
    *         CLIENT                  = SY-MANDT
                logical_filename        = 'Z_SYSBRIDGE' 
             OPERATING_SYSTEM        = SY-OPSYS
    *         PARAMETER_1             = ' '
    *         PARAMETER_2             = ' '
    *         USE_PRESENTATION_SERVER = ' '
    *         WITH_FILE_EXTENSION     = ' '
    *         USE_BUFFER              = ' '
           IMPORTING
    *         emergency_flag          =
    *         file_format             =
                file_name               = ltfile-out_path
           EXCEPTIONS
                file_not_found          = 1
                OTHERS                  = 2.

    Hi Maui,
    Did you check SM69, where the code that ties to this FM creates a file after it execute your FM...
    SM69 are os commands that does UNIX execution or other OS commands...
    or maybe you have missed another FM like FM 'SXPG_OS_COMMAND' or of some sort.
    Thanks
    William Wilstroth

  • How to delete data from a file using IO package

    Hi All,
    i am trying to remove some content of the file.
    this content is not at starting of file not even at end of file.
    can anybody tell me how can i delete number of lines from file using IO package.

    iam having some data in text file .ex:in flowrist.txt
    12/5/07,500,300,6000 like many set of datas are
    there.In these if i want to delete the data based on
    the date which i specified.How to do this specific
    deletion?You need to open a stream to read in the file and then use the indexOf method provided in the Sting class to check if the line contains the date or whatever String you are looking for, if so then skip that line and store or re-write the lines you wish to keep, as well as some extra lines you may wish to add.
    Take a look below at this example found on Google.
    http://www.java-tips.org/java-se-tips/java.io/how-to-read-file-in-java.html
    The above read a file line by line and prints it to console. You should be able to modify this, instead of using System.out to print the line you should use index of to check the lines for a date/String. Index of return -1 if the String you specify is not in the line you parse.

  • 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

  • I am trying to find out how to assign files with particular extensions to the appropriate software. At the moment when I create a file using Word it is apparently given the extension .docx but Word doesn't recognise its own files. How do I alocate th

    I am trying to find out how to assign files with particular extensions to the appropriate software. At the moment when I create a file using Word it is apparently given the extension .docx but Word doesn't recognise its own files. How do I allocate the extension .docx to Word? There used to be a way of doing it, I think under "Preferences" but I can't seem to find it.

    Still in the same location:
    File > Get Info > Open with (select) > Change All (button)

  • How to run .jar on linux & how to create .jar file using java?

    hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
    thanks in advance.

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • Writing Data to a file using TEXT_IO in Forms

    I have a situtation where i have 5 columns and having arabic as well as english data. when i want to write this data to a txt file using TEXT_IO in a specific format, it writes to a file but as soon as it finds an arabic field, it changes the posistion. how can i write to a txt file in the posistion i want???

    vaishnavinatarajan wrote:
    How to write data to a file without leaving any blank lines in the file? How to check if the cursor is placed in the corner of a notepad file using LAB VIEW?
    If you write data to a file, simply don't include any blank lines. We cannot give more specific advice unless you are telling us how you are writing. Are you writing to a new file or appending to an existing file. If the blank lines already exist, you need to read the entire file, remove the undesired lines from the string, and write the data back.
    Notepad files don't have any "corners". Please describe what you are trying to do.
    What is "LAB VIEW"?
    LabVIEW Champion . Do more with less code and in less time .

  • Want To create Zip file  using java,And Unzip without Java Program

    I want to create a zip text file using java, I know Using ZipOutputStream , we can create a zip file, , But i want to open that zip file without java program. suppose i use ZipOutputStream , then zip file is created But for unZip also difftrent program require. We cant open that zip file without writing diff java program.
    Actually i have one text file of big size want to create zip file using java , and unzip simply without java program.Its Possible??
    Here is one answer But I want to open that file normal way(
    For Exp. using winzip we can create a zip file and also open simply)
    http://forum.java.sun.com/thread.jspa?threadID=5182691&tstart=0

    Thanks for your Reply,
    I m creating a zip file using this program, Zip file Created successfully But when im trying to open .zip file i m getting error like "Canot open a zip file, it does not appear to be valid Archive"
    import java.io.*;
    import java.util.zip.*;
    public class ZipFileCreation
         public static void main (String argv[])
         try {
         FileOutputStream fos = new FileOutputStream ( "c:/a.zip" );
         ZipOutputStream zip = new ZipOutputStream ( fos );
         zip.setLevel( 9 );
         zip.setMethod( ZipOutputStream.DEFLATED );
    //     get the element file we are going to add, using slashes in name.
         String elementName = "c:/kalpesh/GetSigRoleInfo092702828.txt";
         File elementFile = new File ( elementName );
    //     create the entry
         ZipEntry entry = new ZipEntry( elementName );
         entry.setTime( elementFile.lastModified() );
    //     read contents of file we are going to put in the zip
         int fileLength = (int)elementFile.length();
         System.out.println("fileLength = " +fileLength);
         FileInputStream fis = new FileInputStream ( elementFile );
         byte[] wholeFile = new byte [fileLength];
         int bytesRead = fis.read( wholeFile , 0 /* offset */ , fileLength );
    //     checking bytesRead not shown.
         fis.close();
    //     no need to setCRC, or setSize as they are computed automatically.
         zip.putNextEntry( entry );
    //     write the contents into the zip element
         zip.write( wholeFile , 0, fileLength );
         zip.closeEntry(); System.out.println("Completed");
    //     close the entire zip
         catch(Exception e) {
    e.printStackTrace();
    }

  • Creating .xls file Using Java I/O

    Hi,
    I am crearting a .xls file from a oracle database that support japanese charsets(i.e it has data in UTF-8 format). I am creating the file using below java statements:
    1. Writer out = new OuputStreamWriter(new FileOutputStream("temp.xls"));
    2. out.write(data);
    So using above statements I am reading data in UTF-8 format and writing it a file using UTF-8 format.
    But my created .xls files does not allow me to see japanese characters as they visible in a browser. But in place of temp.xls if I use temp.txt or temp.doc , then I am able to see the japanese characters when those files are view using TEXTPAD OR MS-WORD APPLICATIONS.
    I have japanese font installed on my machine. So I am not understanding where the actual problem is with my way of file writing or with MS-EXCEL APPLICATION ....
    Please suggest me some solution ....
    Thanks in advance......
    kumar.

    Actually the way u have told result in the same. Even the file is .csv or .xls I am not able to see some japanese characters in my excel application provided I have japanese fonts installed on my machine. But when using the same servlet if i create an .doc or .txt file i am able to see japanese characters when i open .doc or .txt using MS-WORD OR TEXTPAD LIKE APPLICATIONS.

  • Deploying manually CC PKG file built with CC Packager. Not using any third party deployment tool. However after each 5 installations, the PKG files corrupt and cannot be use for a 6th installation. I have to build a new PKG file using CC packager.  Why ?

    Deploying manually CC PKG file built with CC Packager. Not using any third party deployment tool. However after each 5 installations, the PKG files corrupt and cannot be use for a 6th installation. I have to build a new PKG file using CC packager.  Why ?

    http://helpx.adobe.com/creative-cloud/packager.html
    http://forums.adobe.com/community/download_install_setup/creative_suite_enterprise_deploym ent

  • 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

Maybe you are looking for