Load XML records in a normal table

Good afternoon all,
I have a very simple question:
I get a XML file and want to store that data in my Oracle database in a normal table.
I have seen so many answers everywhere, varying from LOBs and using XDB etc.
What i don't understand is why it is so difficult.
When i want to load a CSV file in a table I make a very small Control File CTL and from the command prompt / command line I run the SQL Loader.
Control file:
load data
infile 'import.csv'
into table emp
fields terminated by "," optionally enclosed by '"'          
( empno, empname, sal, deptno )
command:
sqlldr user/password@SID control=loader_Control_File.ctl
Next I connect to the database and run SQL query:
select * from emp;
and i see my data as usual, I can make Crystal Reports on it, etc etc
I really don't understand why this can't be done with an XML file
Oracle know the fields in the table EMP
The xml file has around every field the <EMPNO> and </EMPNO>
Can't be easier than that I would say.
I can understand Oracle likes some kind of description of the XML table, so reference to a XSD file would be understandable.
But all examples are describing LOB things (whatever that is)
Who can help me to get XML data in a normal table?
Thanks
Frank

Hi Frank,
What i don't understand is why it is so difficult.Why do you think that?
An SQL*Loader control file might appear very small and simple to you, but you don't actually see what happens inside the loader itself, I guess a lot of complex operations (parsing, datatype mapping, memory allocation etc.).
XML, contrary to a CSV format, is a structured, well standardized language and could handle far more complex documents than row-organized CSV files.
I think it naturally requires a few extra work (for a developer) to describe what we want to do out of it.
However, using an XML schema is not mandatory to load XML data into a relational table.
It's useful if you're interested in high-performance loading and scalability, as it allows Oracle to fully understand the XML data model it has to deal with, and make the correct mapping with SQL types in the database.
Furthermore, now with 11g BINARY XMLType, performance has been improved with or without schema.
Here's a simple example, loading XML file "import.xml" into table MY_EMP.
Do you find it difficult? ;)
SQL> create or replace directory test_dir as 'D:\ORACLE\test';
Directory created
SQL> create table my_emp as
  2  select empno, ename, sal, deptno
  3  from scott.emp
  4  where 1 = 0
  5  ;
Table created
SQL> insert into my_emp (empno, ename, sal, deptno)
  2  select *
  3  from xmltable('/ROWSET/ROW'
  4         passing xmltype(bfilename('TEST_DIR', 'import.xml'), nls_charset_id('CHAR_CS'))
  5         columns empno  number(4)    path 'EMPNO',
  6                 ename  varchar2(10) path 'ENAME',
  7                 sal    number(7,2)  path 'SAL',
  8                 deptno number(2)    path 'DEPTNO'
  9       )
10  ;
14 rows inserted
SQL> select * from my_emp;
EMPNO ENAME            SAL DEPTNO
7369 SMITH         800.00     20
7499 ALLEN        1600.00     30
7521 WARD         1250.00     30
7566 JONES        2975.00     20
7654 MARTIN       1250.00     30
7698 BLAKE        2850.00     30
7782 CLARK        2450.00     10
7788 SCOTT        3000.00     20
7839 KING         5000.00     10
7844 TURNER       1500.00     30
7876 ADAMS        1100.00     20
7900 JAMES         950.00     30
7902 FORD         3000.00     20
7934 MILLER       1300.00     10
14 rows selected
import.xml :
<?xml version="1.0"?>
<ROWSET>
<ROW>
  <EMPNO>7369</EMPNO>
  <ENAME>SMITH</ENAME>
  <SAL>800</SAL>
  <DEPTNO>20</DEPTNO>
</ROW>
<ROW>
  <EMPNO>7499</EMPNO>
  <ENAME>ALLEN</ENAME>
  <SAL>1600</SAL>
  <DEPTNO>30</DEPTNO>
</ROW>
<!-- more rows here -->
<ROW>
  <EMPNO>7934</EMPNO>
  <ENAME>MILLER</ENAME>
  <SAL>1300</SAL>
  <DEPTNO>10</DEPTNO>
</ROW>
</ROWSET>
Who can help me to get XML data in a normal table?If you have a specific example, feel free to post it, including the following information :
- structure of the target table
- sample XML file
- database version (select * from v$version)
Hope that helps.
Edited by: odie_63 on 9 mars 2011 21:22

Similar Messages

  • OWB11gR2 - simple and easy way to load XML formatted data into db tables?

    Hi,
    we're currently trying to load table data stored in XML files into our datawarehouse using OWB 11gR2.
    However, we're finding this is not quite as trivial as loading flat files...
    Most postings on this forum points to the blog-entry title "Leveraging XDB" found here (http://blogs.oracle.com/warehousebuilder/2007/09/leveraging_xdb.html).
    This blog also references the zip-file owb_xml_etl_utils.zip, which seems to have disappeared from it's original location and can now be found on sourceforge.
    Anyway, the solution described is for OWB 10g, and when trying to import experts from the zip-file etc. we end up not being able to run the "Create ETL from XSD" expert, as the 11gR2 client is different from the 10g and does not have the Experts menu et.al.
    Also, this solution was published over 3 years ago, and it seems rather strange that importing XML-formatted data should still be so cumbersome in the newer warehouse builder releases.
    The OWB 11gR2 documentation is very sparse (or rather - quite empty) on how to load XML data, all it has is a few lines on "XML Transformations", giving no clue as to how one goes about loading data.
    Is this really the state of things? Or are we missing some vital information here?
    We'd have thought that with 11g-releases, loading XML-data would be rather simple, quick and painless?
    Is there somewhere besides the blog mentioned above where we can find simple and to the point guidelines for OWB 11gR2 on how to load XML-formatted data into Oracle tables?
    Regards,
    -Haakon-

    Yes it is possible to use SQL*Loader to parse and load XML, but that is not what it was designed for and so is not recommended. You also don't need to register a schema, just to load/store/parse XML in the DB either.
    So where does that leave you?
    Some options
    {thread:id=410714} (see page 2)
    {thread:id=1090681}
    {thread:id=1070213}
    Those talk some about storage options and reading in XML from disk and parsing XML. They should also give you options to consider. Without knowing more about your requirements for the effort, it is difficult to give specific advice. Maybe your 7-8 tables don't exist and so using Object Relational Storage for the XML would be the best solution as you can query/update tables that Oracle creates based off the schema associated to the XML. Maybe an External Table definition works better for reading the XML into the system because this process will happen just once. Maybe using WebDAV makes more sense for loading XML to be parsed (I don't have much experience with this, just know it is possible from what I've read on the forums). Also, your version makes a difference as you have different options available depending upon the version of Oracle.
    Hope all that helps as a starter.
    Edited by: A_Non on Jul 8, 2010 4:31 PM
    A great example, see the answers by mdrake in {thread:id=1096784}

  • To load multiple records in multiple target tables

    I have to read multiple records as a set from a single source flat file and load into different target tables.
    I have to read 3 records as a set and load into 3 different target tables and read another 3 records as a set and load into previous 3 target tables and it goes on
    till all the records from the flat file are loaded.
    The structure of the file is as follows:
    Header Record
    Line Record
    Distribution Record
    Header Record
    Line Record
    Distribution Record
    Read Header Record and load into target table A
    Read Line Record and load into target table B
    Read Distribution Record and load into target table C
    --- repeat the same steps till all records are read and loaded into target tables.
    I would appreciate if anyone can suggest the best approach of designing interface/package and error conditions to handle ?
    Thanks,
    Ram

    Hi,
    in this case you must create datastore under a 'Flat file' model
    Create for example 3 datastore with the same ressource (file) but change defintion of column
    Generaly on the first column, define the 'pattern' for each specific format 'variable code'
    You must create 3 interfaces and load your target (databse table for example)
    Regards
    Stephane

  • Load xml data to oracle database table

    hi,
    i am facing some problem in fetching from xml data into oracle . That if the table column name and xsl and xsd tag are equal then data is fetching .
    if we we are changing column name in xsl and xsd then data is not fetching.
    the soure is like that
    XSD FILE
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
         </xs:complexType>
         <xs:complexType name="TRANSAC_Type">
    <xs:all>
    <xs:element name="NECRITUR" type="Char4_Type" minOccurs="0" nillable="false"/>
    <xs:element name="NPTF_INT" type="Char2_Type" minOccurs="0" nillable="false"/>
    </xs:all>
    </xs:complexType>
    <xs:simpleType name="Char1_Type">
    <xs:restriction base="xs:string">
    <xs:maxLength value="1"/>
    </xs:restriction>
    </xs:simpleType>
    XSL FILE
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:output method="xml" indent="yes"/>
    <!-- Treatment of fields for table -->
    <xsl:template match="NECRITUR">
    <NO_ECRIT_INT>
    <xsl:value-of select="."/>
    </NO_ECRIT_INT>
    </xsl:template>
    <xsl:template match="NPTF_INT">
    <NPTF_INT>
    <xsl:value-of select="."/>
    </NPTF_INT>
    </xsl:template>
    </xsl:template>
    </xsl:stylesheet>
    Xml file
    <File xmlns:xsi="http://www.’’’’’ ">
    <Header>
    <FileType>TRANSAC</FileType>
    <FileName>TRANSAC.XML</FileName>
    <CreationDate>2007-02-22</CreationDate>
    <CreationTime>14:56:48</CreationTime>
    </Header>
    <Data>
    <TRANSAC>
    <NECRITUR>6</NECRITUR>
    <NPTF_INT>MMMM</NPTF_INT>
    </TRANSAC>
    </Data>
    </File>
    Table Is
    REP (NO_ECRIT_INT, NPTF_INT, CreationDate, CreationTime)
    Regards
    manu
    Message was edited by:
    user561683

    Hi Manu
    Im not quite sure what your question is?
    Are you trying to load data to the database or
    Are you trying to retrieve data from the database ?
    Either way this forum is meant for XML Publisher or BI Publisher issues not just XSL ... you might be better asking on the XML forum.
    Regards, Tim

  • Load XML Document/Data into relational Table

    Hi All,
    I have a requirement to load data in an XML file into an oracle db and subsequently split the contents into columns in an oracle table. This has to be done on the command line from a unix box which connects to a remote oracle DB.
    Can some one give me a step by step procedure to do this or point me in the right direction.
    thank you

    Hi,
    There can be many different way we can achieve this. Mainly depending on size of XML, complexity of XML and your use of that data (e.g. you just want to insert XML into relational or you want to write something and the generate new xmls later on).
    If you go to Oracle online documentation -> Oracle XML DB Developer's guide, first 3-4 chapters will give you what you need.
    Regards

  • XML input stored in normalized tables

    We have a system in place already, but have just found out that we'll be receiving some files intended for dataloads in XML format.
    Where should I start looking for documentation on how to process these files? Most of the docs I've seen so far have to do with storing XML data in XML format. Is that where I'd start, perhaps using a GLOBAL TEMP TABLE which would hold data as XML, and then move the data from that table to the permanent table using SQL?
    Clueless,
    Chuck

    In 9i it is possible to shred the XML documents into normalised tables. Using the Oracle approach is a much better approach than writing your own code to navigate the DOM: I did that in an 8i project and it's some of the most complicated, least maintainable code I ever churned out. Although I imagine the 9i support for XPath might make the task easier.
    Cheers, APC

  • How to load xml data into a database table....

    Hi All,
    Iam new to this forum.I have an xmldoc table of xmltype(datatype).Iam able to insert xml data to it.I have another table called new_books.sql:
    CREATE TABLE NEW_BOOKS
    TITLE          VARCHAR2(255) NOT NULL,
    LINK          VARCHAR2(80) NULL,
    PUBLISHER     VARCHAR2(255) NULL,
    SUBJECT     VARCHAR2(80) NULL,
    PUBDATE     VARCHAR2(40) NULL,
    DESCRIPTION     VARCHAR2(4000) NULL,
    AUTHOR     VARCHAR2(80) NULL,
    PRIMARY      KEY(TITLE)
    Now i want to copy the data in the xmldoc table into the table new_books.sql.Is there any procedure to do that in PL/SQL?
    Given below is the xmlfile:
    - <rdf>
    - <item>
    <title>Enterprise SOA: Designing IT for Business Innovation</title>
    <link>http://safari.oreilly.com/0596102380?a=102682</link>
    <publisher>O'Reilly</publisher>
    <creator>Thomas Mattern</creator>
    <creator>Dan Woods</creator>
    <subject>IT Infrastructure</subject>
    <date>April 2006</date>
    </item>
    </rdf>
    Thanks in Advance,
    Gita.

    Assuming the table xmldoc(of xmltype) has this XML
    SQL> select * from xmldoc;
    SYS_NC_ROWINFO$
    <rdf>
    <item>
    <title>Enterprise SOA: Designing IT for Business Innovation</title>
    <link>http://safari.oreilly.com/0596102380?a=102682</link>
    <publisher>O'Reilly</publisher>
    <creator>Thomas Mattern</creator>
    <creator>Dan Woods</creator>
    <subject>IT Infrastructure</subject>
    <date>April 2006</date>
    </item>
    </rdf>
    SQL> INSERT INTO NEW_BOOKS(TITLE, LINK, PUBLISHER, SUBJECT)
      2  select extractvalue(value(x),'/rdf/item/title') as title,
      3  extractvalue(value(x),'/rdf/item/link') as link,
      4  extractvalue(value(x),'/rdf/item/publisher') as publisher,
      5  extractvalue(value(x),'/rdf/item/subject') as subject
      6  from xmldoc x
      7  ;
    1 row created.

  • Load XML file and transform to table in database

    Hi All,
    If I have a xml file as sample xml data
    <EMPLOYEES>
    - <EMP>
    <EMPNO>7369</EMPNO>
    <ENAME>SMITH</ENAME>
    <JOB>CLERK</JOB>
    <MGR>7902</MGR>
    <HIREDATE>17-DEC-80</HIREDATE>
    <SAL>800</SAL>
    </EMP>
    </EMPLOYEES>
    And I need to import to Emplyees table
    Create table Employees
    ( EMPNO number,
    ENAME varchar2(100),
    JOB varchar2(100),
    MGR number,
    HIREDATE date,
    SAL number
    How to import the xml file to the table?
    Regards,
    Hiko

    Well, if it's a complex XML you can use register a Schema and shred the XML to tables as described on the following thread:
    Re: XML file processing into oracle
    Or if it's fairly simple XML, you can just use XMLTABLE to flatten the data out...
    SQL> ed
    Wrote file afiedt.buf
      1  WITH xml_table AS
      2      (SELECT xmltype('
      3      <root>
      4        <child name="name1">
      5          <grandchild name="name11">
      6            <greatgrandchild name="name111"/>
      7            <greatgrandchild name="name112"/>
      8          </grandchild>
      9          <grandchild name="name12"/>
    10       </child>
    11       <child name="name2">
    12         <grandchild name="name21"/>
    13            <greatgrandchild name="name211"/>
    14         <grandchild name="name22"/>
    15       </child>
    16     </root>') object_value FROM dual)
    17     select po.child_name, gc.gchild_name, ggc.ggchild_name
    18     from   xml_table p
    19           ,xmltable('/root/child'
    20                     passing p.object_value
    21                     columns child_name  varchar2(100) path '@name'
    22                           ,gchild      xmltype       path 'grandchild'
    23                    ) po
    24           ,xmltable('/grandchild'
    25                     passing po.gchild
    26                     columns gchild_name varchar2(100) path '@name'
    27                            ,ggchild     xmltype       path 'greatgrandchild'
    28                   ) (+) gc
    29           ,xmltable('/greatgrandchild'
    30                     passing gc.ggchild
    31                     columns ggchild_name varchar2(100) path '@name'
    32*                  ) (+) ggc
    SQL> /
    CHILD_NAME           GCHILD_NAME          GGCHILD_NAME
    name1                name11               name111
    name1                name11               name112
    name1                name12
    name2                name21
    name2                name22and then insert the results into whatever table(s) you want.

  • Loading some records into Custom-R/3 table manually

    Hai
    I created one custom R/3 table. One of my friend load some records into that cutom table manaully. I want to load some more records manually.
    So how can i load some records into the custom R/3 Table manully . Please let me know
    i ll assing the points
    kumar

    Hi,
    you can do it with SE16 / SE16N or, if exists, via the maintenance tool SM30.
    Out of an excel sheet with the same structure can can copy the entries completey by cut & paste.

  • ORA-22288:file or LOB operation FILEOPEN failed while loading XML file.

    Hello all,
    I am getting the following error messages while loading XML file to Oracle 9i table.
    declare
    ERROR at line 1:
    ORA-22288: file or LOB operation FILEOPEN failed
    No such file or directory
    ORA-06512: at "SYS.DBMS_LOB", line 504
    ORA-06512: at line 10
    The script I am using is all follows:-
    1. Created a file ldxmldata.sh on unix server directory
    dd conv=ucase if=$1|sed 's/<?XML/<?xml/'|sed 's/VERSION/version/'|sed 's
    /RECORD/ROW/'|sed 's/DATE/TRANSDATE/'|sed 's/&/-/'|sed 's/\/DATE>// TRANSDATE>/'>$1.UCASE
    sqlplus sales/sales@rac @upld.sql $1.UCASE
    2. Created SQL file upld.sql on unix server
    set serveroutput on
    exec DBMS_JAVA.SET_OUTPUT(1000000);
    @ldxml.sql bsl.xml.UCASE
    commit;
    exit
    3. Created sql file ldxml.sql on unix server
    declare
    insCtx DBMS_XMLSave.ctxType;
    rows number;
    file bfile := bfilename('XML_DIR','&1');
    charContent CLOB := ' ';
    targetFile bfile;
    warning number;
    begin
    targetFile := file;
    DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly);
    DBMS_LOB.loadfromFile(charContent,targetFile,DBMS_LOB.getLength(tar
    getFile),1,1);
    insCtx := DBMS_XMLSave.newContext('sales.s_price');
    rows := DBMS_XMLSave.insertXML(insCtx,charContent);
    DBMS_XMLSave.closeContext(insCtx);
    DBMS_LOB.fileclose(targetFile);
    end;
    4. As Sys,
    Created a directory XML_DIR and assigned it the path of Unix server directory
    where the script files reside.
    Granted read priviledge on XML_DIR to user sales.
    I am getting the above error messages. Kindly help with some possible solution.
    Arun Patodia
    Bokaro Steel City

    Hi guys,
    Sybrand, aplogoies, the second line of the error stack was on one line in the first post, full error stack below:
    ORA-22288: file or LOB operation FILEOPEN failed
    The program issued a command but the command length is incorrect.
    ORA-06512: at "SYS.DBMS_LOB", line 716
    ORA-06512: at "JLMS.LOAD_DATA_UTIL", line 417
    ORA-06512: at line 2I have looked at that error code as you mentioned, but the second line here doesn't really help much.
    Hoek, i took your advice and tried to replace FILEOPEN with OPEn but got the same error.
    Just to clarify as well, I am not using UNC or relative file paths as I know that these can cause problems.
    Rgds
    Dan

  • Error while loading xml files using JDBC

    Hi,
    I am trying to load xml files into an xmltype table using JDBC calls and am getting this error for some files
    LPX-00200: could not convert from encoding UTF-8 to UCS2
    The xml files and our database are both UTF-8 encoded. The version of oracle that we have here is 9.2.0.6
    Any suggestions in this matter will be greatly appreciated.
    Thanks,
    Uma

    I also experienced this problem and unfortunately this solution didn't work for me given that the tag you suggested was already on the XML file.

  • Issue in loading XML data in BW delta queue

    Hello All,
    My requirement is to stage small amount of XML data in SAP BW. For doing so, i have followed below steps...
    1. Create File data source
    2. Define Myself data source using file data source with Function module
    3. Initialize load process without no data transfer
    4. Using SOAP RFC service, Load xml records in delta queue.
    Now in step number 4, i am unable to open the SOAP RFC service using which we can select the xml file.
    Any help in this regard will be highly appriciated.
    Thanks
    Ketan

    SOAP/RFC service is already activated. Only problem i am facing is as below.......
    1. Created HTML page by copying html snipest
    2. On created HTML page, select XML file as an input and URL of SOAP service which is pointing out to the application server
    3. When i press "Send recordset" button, HTML page throws "Java script" error and data is not being pushed to BW delta queue....
    Please share your ideas to resolve this issue.
    Thanks in advance,
    Ketan

  • Moving Data from Normal table to History tables

    Hi All,
    I'm in the process of moving data from normal tables to
    History tables.
    It can be some sort of a procedure which should be a cron job running at night.
    My aim is to move data say 1.5 yrs or 2yrs old data to History tables.
    What aspects i need to check when moving data. And how can i write a procedure for this requirement.
    The schema is same in both the normal table and history table.
    It has to be a procedure based on particular field RCRE_DT.
    If the rcre_dt is above 2 yrs the data needs to be moved to HIS_<table>.
    I have to insert record in to HIS_table and simultaneously delete record from the normal table.
    This is in Production system and the tables are quite big.
    Pls do find enclosed the attached sample schema for Normal table and HIS_<table>.
    If i want to automate this script as a Cron job for similarly other History tables
    how am i to do it in a single procedure assuming the procedure for moving the data is the same procedure.
    Thanks for ur help in advance.
    SQL> DESC PXM_FLT;
    Name Null? Type
    RCRE_USER_ID NOT NULL VARCHAR2(15)
    RCRE_DT NOT NULL DATE
    LCHG_USER_ID VARCHAR2(15)
    LCHG_DT DATE
    AIRLINE_CD NOT NULL VARCHAR2(5)
    REF_ID NOT NULL VARCHAR2(12)
    BATCH_DT NOT NULL DATE
    CPY_NO NOT NULL NUMBER(2)
    ACCRUAL_STATUS NOT NULL VARCHAR2(1)
    FLT_DT NOT NULL DATE
    OPERATING_CARRIER_CD NOT NULL VARCHAR2(3)
    OPERATING_FLT_NO NOT NULL NUMBER(4)
    MKTING_CARRIER_CD VARCHAR2(3)
    MKTING_FLT_NO NUMBER(4)
    BOARD_PT NOT NULL VARCHAR2(5)
    OFF_PT NOT NULL VARCHAR2(5)
    AIR_CD_SHARE_IND VARCHAR2(1)
    UPLOAD_ERR_CD VARCHAR2(5)
    MID_PT1 VARCHAR2(5)
    MID_PT2 VARCHAR2(5)
    MID_PT3 VARCHAR2(5)
    MID_PT4 VARCHAR2(5)
    MID_PT5 VARCHAR2(5)
    PAX_TYPE VARCHAR2(3)
    PAY_PRINCIPLE VARCHAR2(1)
    SQL> DESC HIS_PXM_FLT;
    Name Null? Type
    RCRE_USER_ID NOT NULL VARCHAR2(15)
    RCRE_DT NOT NULL DATE
    LCHG_USER_ID VARCHAR2(15)
    LCHG_DT DATE
    AIRLINE_CD NOT NULL VARCHAR2(5)
    REF_ID NOT NULL VARCHAR2(12)
    BATCH_DT NOT NULL DATE
    CPY_NO NOT NULL NUMBER(2)
    ACCRUAL_STATUS NOT NULL VARCHAR2(1)
    FLT_DT NOT NULL DATE
    OPERATING_CARRIER_CD NOT NULL VARCHAR2(3)
    OPERATING_FLT_NO NOT NULL NUMBER(4)
    MKTING_CARRIER_CD VARCHAR2(3)
    MKTING_FLT_NO NUMBER(4)
    BOARD_PT NOT NULL VARCHAR2(5)
    OFF_PT NOT NULL VARCHAR2(5)
    AIR_CD_SHARE_IND VARCHAR2(1)
    UPLOAD_ERR_CD VARCHAR2(5)
    MID_PT1 VARCHAR2(5)
    MID_PT2 VARCHAR2(5)
    MID_PT3 VARCHAR2(5)
    MID_PT4 VARCHAR2(5)
    MID_PT5 VARCHAR2(5)
    PAX_TYPE VARCHAR2(3)
    PAY_PRINCIPLE VARCHAR2(1)

    Hi All,
    Thanks for ur valuable suggestion.But can u explain me bit more on this as i'm still confused about switching between partitoned tables and temporary table.Suppose if i have a table called PXM_FLT and an correspoding similar table named HIS_PXM_FLT.How can i do the partitioning shd i do the partitioning on the normal table or HIS_PXM_FLT.i do have a date field for me to partition based on range.Can u pls explain why shd i again create a temp.table.What's the purpose.Now the application is designed in such a way that old records have to be moved to HIS_PXM_FLT.can u pls highlight more on this.Your suggestions are greatly appreciated.As i'm relatively new to this partitioning technique i'm bit confused on how it works.But i came to understand Partitioning is a better operation than the normal insert or delte as it is more data intensive as millions of record need to be moved.Thanks for feedback and ur precious time.

  • Error in loading XML data in BW delta queue

    Hi All
    My requirement is to stage small amount of XML data in SAP BW 3.5. For doing so, i have followed the steps specified in How to send XML data to BW
    Link for "How to send XML data to BW"
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/21d8aa90-0201-0010-5e83-a3798b9a5ee0
    1. Created File data source
    2. Defined data source using file data source with Function module
    3. Initialize load process without no data transfer
    4. Using SOAP RFC service, Load xml records in delta queue.
    Now in step number 4, i have created the following
    1. Created the html code
    2. On created HTML page, select .CSV file as an input and URL of SOAP service which is pointing out to the application server
    3. When i press "XML Send recordset" button, HTML page throws "Java script" error and data is not being pushed to BW delta queue
    Any help in this regard will be highly appreciated.
    Thanks
    Yeshwant

    Hi All
    My requirement is to stage small amount of XML data in SAP BW 3.5. For doing so, i have followed the steps specified in How to send XML data to BW
    Link for "How to send XML data to BW"
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/21d8aa90-0201-0010-5e83-a3798b9a5ee0
    1. Created File data source
    2. Defined data source using file data source with Function module
    3. Initialize load process without no data transfer
    4. Using SOAP RFC service, Load xml records in delta queue.
    Now in step number 4, i have created the following
    1. Created the html code
    2. On created HTML page, select .CSV file as an input and URL of SOAP service which is pointing out to the application server
    3. When i press "XML Send recordset" button, HTML page throws "Java script" error and data is not being pushed to BW delta queue
    Any help in this regard will be highly appreciated.
    Thanks
    Yeshwant

  • Loading XML tables.

    Hi,
    I have managed to successfully register xml schema and create the xml tables. I now need to load the data into these tables. I am now working on different scenarios of loading the XML data into these tables.
    I successfully experimented with the SQL/PLSQL options as well as SQL*Loader. I am reluctant to try the C and JAVA based interfaces because, frankly that is a completely new field for me and will present a huge learning curve that I won’t be able to pull off in short time I need to put this application in production.
    My scenario, I have about 250 XML tables which I’m going to populate from XML data files containing thousands of records. I need the lode process to be automatic such that I can do scheduled runs.
    The problem I have is SQL*Loader, and I am strictly going by the example given in the Oracle documentation, is that it requires for me to put ‘0’ for every record in the file. Here’s what my sample control file looks like,
    LOAD DATA
    INFILE *
    INTO TABLE "MCF_Custom_Form_Date_Rg" APPEND
    xmltype(xmldata)
    FIELDS
    xmldata LOBFILE (CONSTANT sampleload1.xml) TERMINATED BY '[XML]'
    BEGINDATA
    0
    0
    0
    This method works if I have finite number of records which I’ll need to count before hand and add a ‘0’ for each record. That’s not an optimal solution because I will not know the number of records before hand. Is there any way of changing this behavior?
    I am kind of stumped. What are my other alternatives? I read some where about SAX load utility. Where can I find more documentation about it? Can I run automated loading programs using it?
    Any help on this would be greatly appreciated.
    Regards,
    AVJ.

    Anand, you might want to try something using xmldb repository since it allows you to do the FTP operations for the xml files and FTP operations can be scheduled.
    First check of your database already accepts FTP operations.
    From the command prompt type
    FTP
    FTP> OPEN <DATABASE SERVER NAME> 2100
    Next it asks for a user which you can give database user and password.
    Now the lets consider this example schema.
    <!-- edited with XML Spy v4.0 U (http://www.xmlspy.com) by Mark (Drake) -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0">
         <xs:element name="PurchaseOrder" type="PurchaseOrderType" xdb:defaultTable="PURCHASEORDER"/>
         <xs:complexType name="PurchaseOrderType" xdb:SQLType="XDBPO_TYPE">
              <xs:sequence>
                   <xs:element ref="Reference"/>
                   <xs:element name="Actions" type="ActionsType" xdb:SQLName="ACTIONS"/>
                   <xs:element name="Reject" type="RejectType" minOccurs="0" xdb:SQLName="REJECTION"/>
                   <xs:element ref="Requestor"/>
                   <xs:element ref="User"/>
                   <xs:element ref="CostCenter"/>
                   <xs:element name="ShippingInstructions" type="ShippingInstructionsType" xdb:SQLName="SHIPPINGINSTRUCTIONS"/>
                   <xs:element ref="SpecialInstructions"/>
                   <xs:element name="LineItems" type="LineItemsType" xdb:SQLName="LINEITEMS"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="LineItemsType" xdb:SQLType="XDBPO_LINEITEMS_TYPE">
              <xs:sequence>
                   <xs:element name="LineItem" type="LineItemType" maxOccurs="unbounded" xdb:SQLName="LINEITEM" xdb:SQLCollType="XDBPO_LINEITEM_COLLECTION"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="LineItemType" xdb:SQLType="XDBPO_LINEITEM_TYPE">
              <xs:sequence>
                   <xs:element ref="Description"/>
                   <xs:element ref="Part"/>
              </xs:sequence>
              <xs:attribute name="ItemNumber" type="xs:integer" xdb:SQLName="ITEMNUMBER" xdb:SQLType="NUMBER"/>
         </xs:complexType>
         <xs:element name="Reference" xdb:SQLName="REFERENCE" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="18"/>
                        <xs:maxLength value="30"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Part" xdb:SQLType="XDBPO_PART_TYPE" xdb:defaultTable="">
              <xs:complexType>
                   <xs:attribute name="Id" xdb:SQLName="PARTNO" xdb:SQLType="VARCHAR2">
                        <xs:simpleType>
                             <xs:restriction base="xs:string">
                                  <xs:minLength value="12"/>
                                  <xs:maxLength value="14"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
                   <xs:attribute name="Quantity" type="money" xdb:SQLName="Quantity" xdb:SQLType="NUMBER"/>
                   <xs:attribute name="UnitPrice" type="quantity" xdb:SQLName="UNITPRICE" xdb:SQLType="NUMBER"/>
              </xs:complexType>
         </xs:element>
         <xs:complexType name="ActionsType" xdb:SQLType="XDBPO_ACTIONS_TYPE">
              <xs:sequence>
                   <xs:element name="Action" maxOccurs="4" xdb:SQLName="ACTION" xdb:SQLCollType="XDBPO_ACTION_COLLECTION">
                        <xs:complexType xdb:SQLType="XDBPO_ACTION_TYPE">
                             <xs:sequence>
                                  <xs:element ref="User"/>
                                  <xs:element ref="Date" minOccurs="0"/>
                             </xs:sequence>
                        </xs:complexType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="RejectType" xdb:SQLType="XDBPO_REJECTION_TYPE">
              <xs:all>
                   <xs:element ref="User" minOccurs="0"/>
                   <xs:element ref="Date" minOccurs="0"/>
                   <xs:element ref="Comments" minOccurs="0"/>
              </xs:all>
         </xs:complexType>
         <xs:complexType name="ShippingInstructionsType" xdb:SQLType="XDBPO_SHIPINSTRUCTIONS_TYPE">
              <xs:sequence>
                   <xs:element ref="name"/>
                   <xs:element ref="address"/>
                   <xs:element ref="telephone"/>
              </xs:sequence>
         </xs:complexType>
         <xs:simpleType name="money">
              <xs:restriction base="xs:decimal">
                   <xs:fractionDigits value="2"/>
                   <xs:totalDigits value="12"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="quantity">
              <xs:restriction base="xs:decimal">
                   <xs:fractionDigits value="4"/>
                   <xs:totalDigits value="8"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:element name="User" xdb:SQLName="USERID" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="10"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Requestor" xdb:SQLName="REQUESTOR" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="0"/>
                        <xs:maxLength value="128"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="CostCenter" xdb:SQLName="COSTCENTER" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="4"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Vendor" xdb:SQLName="VENDOR" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="0"/>
                        <xs:maxLength value="20"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="PONumber" xdb:SQLName="PONUMBER" xdb:SQLType="NUMBER" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:integer"/>
              </xs:simpleType>
         </xs:element>
         <xs:element name="SpecialInstructions" xdb:SQLName="SPECIALINSTRUCTIONS" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="0"/>
                        <xs:maxLength value="2048"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="name" xdb:SQLName="SHIPTONAME" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="20"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="address" xdb:SQLName="ADDRESS" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="256"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="telephone" xdb:SQLName="PHONE" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="24"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Date" type="xs:date" xdb:SQLName="DATEACTIONED" xdb:SQLType="DATE" xdb:defaultTable=""/>
         <xs:element name="Comments" xdb:SQLName="COMMENTS" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="2048"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Description" xdb:SQLName="DESCRIPTION" xdb:SQLType="VARCHAR2" xdb:defaultTable="">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                        <xs:minLength value="1"/>
                        <xs:maxLength value="256"/>
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
    </xs:schema>
    Here you can check at the top there is defaultTable="PURCHASEORDER". So after the registration of this schema you will find a table PURCHASEORDER in your database. This table is created only if the GENTABLE parameter value was set to TRUE during schema registration.
    Now you can FTP the xml-instance file. Note during the registration of the xml schema, you would have given a URL to identify this schema uniquely in the database.
    This URL should be present in the xml-instance file as part of noNamespaceSchemaLocation tag.
    Now for FTP operations you need couple of things like a folder path on the reposity. see the documentation on how create the folder on the XMLDB repository.
    Now FTP the xml instance file to the folder. Automatically using the value specified in the noNamespaceSchemaLocation tag, Oracle recognizes that this instance file belongs to a particular XML schema which has a defaultTable PURCHASEORDER. It will push this xml file automatically into this table.
    you can check that using select count(*) from purchaseorder after the FTP operation.
    You can automate this process of FTP operations.
    refer documentation XMLDB Developers Guide, it has detail information about repository and how to query your files in the repository.
    good luck.

Maybe you are looking for

  • How to avoid OR's(too many) in WHERE clause????

    I have similar code(below given is a sample prepared by me) in one of the existing SP. dbo.[STUDENT] T1 INNER JOIN dbo.[COLLEGE] T2 INNER JOIN dbo.[DEPARTMENT] T3 INNER JOIN dbo.[EXAM] T4  WHERE T1.[student_id] = @student_id AND ( (T1.[student_grade]

  • Possible to add sub-pages ?

    Hello, I began to create a site in iWeb. For presentation and organisation issues, I would like to add subpages to it -i.e. to have pages links that shows only on a certain page and not the navigation menu) Example: On the site there is a page of pic

  • Passing parameters to a Crystal Reports JavaBean connection

    Hi, I'm trying to pass a parameter to a CR XI JavaBean connection. So far I can read and show a String parameter in the report, but I'm unable to pass it to the getResultSet(String aParameter) method that provides the ResultSet. The Crystal Reports e

  • JDBC is the Acronym of Java Database Connectivity - Yes / No?

    Hi, JDBC is the Acronym of Java Database Connectivity - Yes / No? I am little bit confused. I got this question in an Inteview. I support yes. But some of the compitiors say no. What will the real answer?

  • Oracle Driver For Arabic Data

    hi all, My problem is, in my oracle UI, i can write an insert statement and enter arabic data into my oracle database. But if i try to execute the same SQL statement from VB, the data goes all corrupted, and i cannot retrieve the arabic data in arabi