Create XML file from table data

Dear All,
with dataservice 4.0, I want to create an XML file from a table data.
Table have a single column but more record, for example:
0001000488;100;EUR;
0001000489;200;EUR;
0001000450;300;EUR;
My desired XML output:
<Data>
  0001000488;100;GBP;
  0001000489;200;EUR;
  0001000450;300;EUR;
</Data>
I try with a sample query but the sistem write only the last record in XML file:
<Data>
  0001000450;300;EUR;
</Data>
Can everyone help me?
Thank in advance.
Simone

Hello
That is a very simple (also odd) XML document structure, and as such doesn't require use of the XML target.  It can be easily acheived by writing a normal file with a header and footer, which is acheived using a row_generation and a query to generate the hard coded open and close tags.
Michael

Similar Messages

  • Seeking simple example pl/sql to create text file from table data

    hello,
    I am hoping someone can provide very simple example of creating a file on my local harddrive using a pl/sql program. The basic steps are as follows:
    First, I store some text in a varchar2 variable like this:
    1. select sometext into otextvar from mytable where recordid = 1;
    Second, I want this text to become a file in my data directory:
    2. c:\data\sometext.txt
    The second step is where I need help.
    Any suggestions are greatly appreciated.

    Use this function
    It will create for you a file in your /home/oracle directory with sysdate name and will insert all table names in it
    CREATE OR REPLACE PROCEDURE my_proc AS
    CURSOR cursor1 IS
    SELECT table_name from all_tables;
    CURSOR cursor2 IS
    SELECT sysdate from dual;
    rec1 cursor1%ROWTYPE;
    rec2 cursor2%ROWTYPE;
    created_file_name VARCHAR2(100);
    file_name utl_file.file_type;
    BEGIN
    OPEN cursor2;
    LOOP
    FETCH cursor2 INTO rec2;
    EXIT WHEN cursor2%NOTFOUND;
    created_file_name:=rec2.sysdate;
    file_name := utl_file.fopen('/home/oracle', created_file_name,'W');
    OPEN cursor1;
    LOOP
    FETCH cursor1 INTO rec1;
    EXIT WHEN cursor1%NOTFOUND;
    utl_file.putf(file_name, '%s\n',rec1.TABLE_NAME);
    END LOOP;
    utl_file.fclose(file_name);
    END LOOP;
    END my_proc;
    SQL>exec my_proc;

  • Creating XML files from one data file in a java program

    <statement>
         <name>John Dow </name>
         <address>123 Main</address>
         <phone>972-213-3434</phone>
    </statement>
    <statement>
         <name>Jane Dow </name>
         <address>345 Main</address>
         <phone>972-213-3534</phone>
    </statement>
    <statement>
         <name>Marry Dow </name>
         <address>678 Main</address>
         <phone>972-213-3435</phone>
    </statement>
    Thanks,
    Bill

    So how does it take this file
    file>
    <statement>
    <name>John Dow </name>
    <address>123 Main</address>
    <phone>972-213-3434</phone>
    </statement>
    <statement>
    <name>Jane Dow </name>
    <address>345 Main</address>
    <phone>972-213-3534</phone>
    </statement>
    <statement>
    <name>Marry Dow </name>
    <address>678 Main</address>
    <phone>972-213-3435</phone>
    </statement>
    </file>
    and create these three different one?
    1.)
    <statement>
    <name>John Dow </name>
    <address>123 Main</address>
    <phone>972-213-3434</phone>
    </statement>
    2.)
    <statement>
    <name>Jane Dow </name>
    <address>345 Main</address>
    <phone>972-213-3534</phone>
    </statement>
    3.)
    <statement>
    <name>Marry Dow </name>
    <address>678 Main</address>
    <phone>972-213-3435</phone>
    </statement>
    Is it not going to just grab each element after the file tag? I'm just confused about that.

  • How to export a data as an XML file from oracle data base?

    could u pls tell me the step by step procedure for following questions...? how to export a data as an XML file from oracle data base? is it possible? plz tell me itz urgent requirement...
    Thankz in advance
    Bala

    SQL> SELECT * FROM v$version;
    BANNER
    Oracle DATABASE 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS FOR 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    5 rows selected.
    SQL> CREATE OR REPLACE directory utldata AS 'C:\temp';
    Directory created.
    SQL> declare                                                                                                               
      2    doc  DBMS_XMLDOM.DOMDocument;                                                                                       
      3    xdata  XMLTYPE;                                                                                                     
      4                                                                                                                        
      5    CURSOR xmlcur IS                                                                                                    
      6    SELECT xmlelement("Employee",XMLAttributes('http://www.w3.org/2001/XMLSchema' AS "xmlns:xsi",                       
      7                                  'http://www.oracle.com/Employee.xsd' AS "xsi:nonamespaceSchemaLocation")              
      8                              ,xmlelement("EmployeeNumber",e.empno)                                                     
      9                              ,xmlelement("EmployeeName",e.ename)                                                       
    10                              ,xmlelement("Department",xmlelement("DepartmentName",d.dname)                             
    11                                                      ,xmlelement("Location",d.loc)                                     
    12                                         )                                                                              
    13                   )                                                                                                    
    14     FROM   emp e                                                                                                       
    15     ,      dept d                                                                                                      
    16     WHERE  e.DEPTNO=d.DEPTNO;                                                                                          
    17                                                                                                                        
    18  begin                                                                                                                 
    19    OPEN xmlcur;                                                                                                        
    20    FETCH xmlcur INTO xdata;                                                                                            
    21    CLOSE xmlcur;                                                                                                       
    22    doc := DBMS_XMLDOM.NewDOMDocument(xdata);                                                                           
    23    DBMS_XMLDOM.WRITETOFILE(doc, 'UTLDATA/marco.xml');                                                                  
    24  end;                                                                                                                  
    25  /                                                                                                                      
    PL/SQL procedure successfully completed.
    .

  • How to create xml file from original

    I have this complicated xml and I want to search through it and make a new xml with only element I find that match. what is the best way to do this? the file
    is about 6mb and I want to read the whole file easily..should i load to database table and create a file from table? I have found issues reading the file..
    - <ArrayOfJobClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <JobClass>
    - <Triggers>
    - <TriggerClass>
    <ExpireActionType>Delete</ExpireActionType>
    <ExpireType>DateTime</ExpireType>
    <TriggerType>TimeType</TriggerType>
    - <TTime>
    <TimeTriggerType>Custom</TimeTriggerType>
    <IntervalType>Daily</IntervalType>
    <SpecificType>Days</SpecificType>
    <FirstLastType>First</FirstLastType>
    <IntervalValue>1</IntervalValue>
    <FirstLastWeekDay>Monday</FirstLastWeekDay>
    <InitDate>2009-05-04T14:17:05.40625-07:00</InitDate>
    - <IntervalDays>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>
    <boolean>false</boolean>

    You can load it in the database in an XMLType table (Object-Relational or Binary XML storage), use XQuery on the XML content and then write back the result to a file.
    Or, you might just use an external processor (XSLT or XQuery).
    If you want to stay in the Oracle world, you can use :
    - For XSLT : $ORACLE_HOME/bin/oraxsl (it's a wrapper for the java XSLT engine)
    - For XQuery : the java XQuery API
    Personally, I sometimes use the Saxon XSLT and XQuery processor, quite efficient.
    Here's a simplistic example with oraxsl utility :
    emp.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <emps>
      <emp id="7369">
        <name>SMITH</name>
        <job>CLERK</job>
        <salary>800</salary>
      </emp>
      <emp id="7499">
        <name>ALLEN</name>
        <job>SALESMAN</job>
        <salary>1600</salary>
      </emp>
      <emp id="7521">
        <name>WARD</name>
        <job>SALESMAN</job>
        <salary>1250</salary>
      </emp>
      <emp id="7566">
        <name>JONES</name>
        <job>MANAGER</job>
        <salary>2975</salary>
      </emp>
      <emp id="7654">
        <name>MARTIN</name>
        <job>SALESMAN</job>
        <salary>1250</salary>
      </emp>
    </emps>
    emp.xsl
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="text()"/>
    <xsl:template match="emps/emp[job='SALESMAN']">
      <xsl:copy-of select="."/>
    </xsl:template>
    </xsl:stylesheet>Applying the transformation to search and extract all "salesmen" :
    D:\ORACLE\test>%ORACLE_HOME%\bin\oraxsl emp.xml emp.xsl result.xml
    D:\ORACLE\test>type result.xml
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <emp id="7499">
        <name>ALLEN</name>
        <job>SALESMAN</job>
        <salary>1600</salary>
      </emp><emp id="7521">
        <name>WARD</name>
        <job>SALESMAN</job>
        <salary>1250</salary>
      </emp><emp id="7654">
        <name>MARTIN</name>
        <job>SALESMAN</job>
        <salary>1250</salary>
      </emp>

  • Creating XML file from Java Bean

    Hi
    Are there any standard methods in Java 1.5 to create XML file from java bean,
    i can use JAXB or castor to do so,
    But i would like to know if there is any thing in java core classes,
    I have seen XMLEncoder, but this is not what i want.
    Any ideas
    Ashish

    Marshall JavaBean to an XML document with JAXB or XMLBeans.

  • How to create xml file from Oracle and sending the same xml file to an url

    How to create xml file from Oracle and sending the same xml file to an url

    SQL/XML (XMLElement, XMLForest, XMLAgg, etc) and UTL_HTTP.
    Whether that works for you with the version of Oracle you have, your requirements, and needs is another story. A little detail goes a long way.

  • How to create xml file from relational tables in 10gR2

    Hi,
    I am very new to XML and was wondering how to create an XML file from querying relational tables. Some child tables may contain multiple rows that need to be returned in certain instances. Other queries will just be single or multiple rows from one or more tables. I would like to use the latest feathers in 10gR2. Thanks for any help you can provide.
    Thanks,
    Lee

    Here is the first row of data created from our person table - it used the column names as the tag names:
    <?xml version="1.0"?>
    <ROWSET>
         <ROW>
              <MP_ID_SEQ>289</MP_ID_SEQ>
              <MP_NAME>LOBERG,JUDITH LEE</MP_NAME>
              <MP_SEX>F</MP_SEX>
              <MP_RACE>I</MP_RACE>
              <MP_DOB>19500709</MP_DOB>
              <MP_HT>504</MP_HT>
              <MP_WT>170</MP_WT>
              <MP_EYE_CLR>BLU</MP_EYE_CLR>
              <MP_HAIR_CLR>BRO</MP_HAIR_CLR>
              <MP_SKN>RUD</MP_SKN>
              <MP_SMT>POCKMARKS</MP_SMT>
              <MP_SOC>517607968</MP_SOC>
              <MP_OLN>517607968</MP_OLN>
              <MP_OLS>MT</MP_OLS>
              <MP_OLY>2007</MP_OLY>
              <MP_CAUT_MED>70</MP_CAUT_MED>
              <MP_VISION_SCRIPT>C0RRECTIVE LENSES</MP_VISION_SCRIPT>
              <MP_DNA_AVAIL>N</MP_DNA_AVAIL>
              <CREATED_BY>MMPS</CREATED_BY>
              <DTM_CREATED>31-AUG-06</DTM_CREATED>
              <MI_INC_ID_SEQ>288</MI_INC_ID_SEQ>
              <MP_ALERT>N</MP_ALERT>
         </ROW>

  • Create XML file from ABAP with SOAP Details

    Hi,
    I am new to XML and I am not familiar with JAVA or Web Service. I have searched in SDN and googled for a sample program for creating XML document from ABAP with SOAP details. Unfortunately I couldn't find anything.
    I have a requirement for creating an XML file from ABAP with SOAP details. I have the data in the internal table. There is a Schema which the client provided and the file generated from SAP should be validating against that Schema. Schema contains SOAP details like Envelope, Header & Body.
    My question is can I generate the XML file using CALL TRANSFORMATION in SAP with the SOAP details?
    I have tried to create Transformation (Transaction XSLT_TOOL) in SAP with below code. Also in CALL transformation I am not able to change the encoding to UTF-8. It's always show UTF-16.
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="/">
        <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
          <SOAP:Header>
            <CUNS:HeaderInfo>
              <CUNS:InterfaceTypeId>10006</InterfaceTypeId>
              <CUNS:BusinessPartnerID>11223344</BusinessPartnerID>
              <CUNS:SchemaVersion>1.0</SchemaVersion>
              <CUNS:DateTime>sy-datum</DateTime>
            </CUNS:HeaderInfo>
          </SOAP:Header>
          <SOAP:Body>
            <xsl:copy-of select="*"/>
          </SOAP:Body>
        </SOAP:Envelope>
      </xsl:template>
    </xsl:transform>
    In ABAP program, I have written below code for calling above Transformation.
      call transformation ('Z_ID')
           source tab = im_t_output[]
           result xml xml_out.
      call function 'SCMS_STRING_TO_FTEXT'
        exporting
          text      = xml_out
        tables
          ftext_tab = ex_t_xml_data.
    Please help me how to generate XML file with SOAP details from ABAP. If anybody have a sample program, please share with me.
    Is there any easy way to create the XML file in CALL Transformation. Please help.
    Thanks

    Try ABAP forum, as it seems not to be PI related.

  • PL/SQL: numeric or value error when extracting xml file from tables.

    create or replace FUNCTION proc_generate_xml_from_tables(p_directory in varchar2,
    p_areaname in varchar2)
    return integer
    AS
    qryCtx DBMS_XMLGEN.ctxHandle;
    result CLOB;
    clob_len number := 0;
    file_ptr utl_file.file_type;
    oTableName restore_metadata.table_name%type;
    o_filename restore_metadata.table_name%type;
    cursor metadata_restore_list(p_area varchar2) is
    select * from restore_metadata
    where instr(area_name,upper(p_Area)) > 0
    order by degree;
    vtabcount number := 0;
    sql_stmt varchar2(300);
    BEGIN
    dbms_lob.createtemporary(result, true,dbms_lob.session);
    oTableName := upper('MAINT_ACTVS');
    vtabcount := 0;
    sql_stmt := 'select count(*) from ' || oTableName;
    execute immediate sql_stmt into vtabcount;
    o_filename := oTableName || '.xml';
    file_ptr := utl_file.fopen(p_directory,o_filename,'W');
    dbms_output.put_line(oTableName);
    qryCtx := dbms_xmlgen.newcontext('select * from ' || oTableName);
    result := dbms_xmlgen.getxml(qryCtx);
    --dbms_output.put_line(result);
    clob_len := dbms_lob.getlength(result);
    dbms_output.put_line('Length of the clob file' || clob_len);
    utl_file.put_line(file_ptr,result);
    utl_file.fclose(file_ptr);
    dbms_xmlgen.closeContext(qryCtx);
    dbms_lob.freetemporary(result);
    return 0;
    EXCEPTION
    when others THEN
    utl_file.fclose(file_ptr);
    dbms_output.put_line('Table Name into Consideration :- ' || oTableName);
    dbms_output.put_line('Oracle Error Number:- ' || sqlcode || ' Ora Message :- ' || sqlerrm);
    return -1;
    END;
    I am getting the following errors..
    SQL> @temp1.sql
    MAINT_ACTVS
    Length of the clob file34245
    Table Name into Consideration :- MAINT_ACTVS
    Oracle Error Number:- -6502 Ora Message :- ORA-06502: PL/SQL: numeric or value error
    What am I doing wrong here?
    DB version is Oracle 10g
    Edited by: userAtoZ on May 6, 2011 2:55 PM

    >
    My problem lies that my xml file is having data more than 32 K.
    When I write it 32K at a time then it work fine.
    >
    Then break it down.
    l_pos number;
    WHILE (l_pos <= clob_len)
      LOOP
        UTL_FILE.PUT_LINE (file_ptr,DBMS_LOB.SUBSTR ( RESULT , 32767,l_pos));
        l_pos := l_pos + 32767;
      END LOOP;
    utl_file.fclose(file_ptr);
     

  • Create XML file from XSD

    Hello,
    can anybody help me with generating an empty tagged XML file from a XSD file. Any sample java code will be highly appreciated.
    Thanx in advance.
    A .

    Apache XML Beans presents a way to compile the XSD Schema and generate Java classes for each element defined in the schema. With these interface you can then create new XML instances from the schema. (http://xmlbeans.apache.org/)

  • Can not create XML file from MS Access 2003

    Hi,
    I am getting error as "Error loading in DLL" when I use msaccess_exporter to create XML file for migrations usind Access 2003 DB. Does anyone know about this? If yes, could you please let me know how to resolve it?
    Thanks,
    Kartik

    Hi Daniel,
    I believe you are seeing the message "Table'_OracletblDatabase' already exists" because you are attempting to export an MDB file that you previously attempted to export, but that initial export process may not have run to completion. I recommend opening your .MDB file, and delete any "_Oracletbl..." table objects that exist under the list of Table objects. Close the MDB file and carry out the export process again. You should now be able to use the 2000 mde file.
    I hope this helps.
    Regards,
    Hilary

  • Generate XML File from table

    How to generate XML file from a table without using UTL_FILE that too in local machine...

    You downloaded the wrong XML Parser!
    XSQL requires Java Parser. Well, there's a copy included with the XSQL package so you actually don't need to do another download.
    You really don't need XSQL if you just want a XML file from DB, you just needed a XML SQL Utility. Download that and run the samples.

  • Create XML file from Oracle DB

    Hi,
    I'm working in a task to create electronic billing for Mexico Rules, to do this; I need to create a XML source that will contain all the information requested from Oracle DB.
    For this reason, I'm looking how to create this XML file from Oracle DB.
    All this is for the new legislations rules in Mexico to use electronic billing.
    Please, if you have any reference about this, let me know.
    Thanks and regards.

    you may want to check out commands like xmlforest and xmlelement
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions221.htm
    copied from documentation
    Purpose
    XMLForest converts each of its argument parameters to XML, and then returns an XML fragment that is the concatenation of these converted arguments.
    •If value_expr is a scalar expression, then you can omit the AS clause, and Oracle Database uses the column name as the element name.
    •If value_expr is an object type or collection, then the AS clause is mandatory, and Oracle uses the specified c_alias as the enclosing tag. The c_alias can be up to 4000 characters.
    •If value_expr is null, then no element is created for that value_expr.
    Examples
    The following example creates an Emp element for a subset of employees, with nested employee_id, last_name, and salary elements as the contents of Emp:
    SELECT XMLELEMENT("Emp",
    XMLFOREST(e.employee_id, e.last_name, e.salary))
    "Emp Element"
    FROM employees e WHERE employee_id = 204;
    Emp Element
    <Emp>
    <EMPLOYEE_ID>204</EMPLOYEE_ID>
    <LAST_NAME>Baer</LAST_NAME>
    <SALARY>10000</SALARY>
    </Emp>

  • Create Menu items from table data?

    Wondering if anyone knows of a way(if even possible) to create menu items on logon from table data where the menu data is stored?

    You'd have to make the menu code generic as well - probably the bet bet would be to have each menu item calling a common procedure but passing in the menu item selected - you'll then have to cross reference that with the current function of that menu item and do the right thing.

Maybe you are looking for

  • Previewing imported bitmaps for Illustrator CS4 using Windows XP

    Hi all Can anyone tell me if it is possible to preview a bitmap while importing it into Illustrator CS4 (File>Place). I am using Windows XP SP3 and I know you can see a preview on bitmaps with the Mac version. Any help much appreciated. Thanks George

  • Pricing Procedure IN STO PO

    Hi,   Please tell the Procedure to create the Pricing Procedure for the STO Purchase Order. I want to Maintain a Pricing Procedure in STO similar to the standard PO. Regards, Kapil.

  • OS X 10.6.8 updates not visible from Server 10.6.8 SUS

    SUS downloads, copies, and enables all updates from 10.4 to 10.9, but clients can't see any of the updates. I've pointed a client on 10.6.8 using: sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate CatalogURL http://<MyCatalogIP>:8088/

  • Does Excel-Addin is supported  by Excel 2013

    Hello All, We are in processing of upgrading the versions of Microsoft office from 2010 to 2013 for our users who are using Essbase Excel add-in. In 2010 the Excel Add-in is supported and working but  my question is will it works for Excel 2013 also.

  • Loading my library on a new computer

    Hopefully this is a simple question, but I am not very tech minded and can't figure it out. I bought a new laptop, and before setting it up "tried" to save my songs from the old laptop onto an external drive. Turns out its only an itunes shortcut tha