Loading xml file in to database (inserting only one level)

Hi All,
  I am trying to load an xml file into db using ssis..when i am trying to load the data in xml its loading only first row..
sample xml:
<?xml version="1.0"?>
  <Products>
    <Product ID="Level1_75000000" UserTypeID="Level1" ParentID="Products_6537">
      <Name>Household/Office Furniture/Furnishings</Name>
      <Product ID="Level2_75020000" UserTypeID="Level2">
        <Name>Fabric/Textile Furnishings</Name>
        <Product ID="Level3_75020100" UserTypeID="Level3">
          <Name>Household/Office Fabric/Textile Furnishings</Name>
          <Product ID="Level4_10002215" UserTypeID="Level4">
            <Name>Fabric/Textile Window Blinds</Name>
          </Product>
          <Product ID="Level4_10002214" UserTypeID="Level4">
            <Name>Curtains</Name>
          </Product>
          <Product ID="Level4_10002221" UserTypeID="Level4">
            <Name>Household/Office Fabric/Textile Furnishings Other</Name>
          </Product>
          <Product ID="Level4_10002220" UserTypeID="Level4">
            <Name>Household/Office Fabric/Textile Furnishing Variety Packs</Name>
          </Product>
          <Product ID="Level4_10002219" UserTypeID="Level4">
            <Name>Fabric/Textile Towels</Name>
          </Product>
          <Product ID="Level4_10002218" UserTypeID="Level4">
            <Name>Furnishing Floor Rugs/Mats - Detachable</Name>
          </Product>
          <Product ID="Level4_10002217" UserTypeID="Level4">
            <Name>Cushions</Name>
          </Product>
          <Product ID="Level4_10002216" UserTypeID="Level4">
            <Name>Furnishing Covers/Cloths - Detachable</Name>
          </Product>
        </Product>      
        <Name>Ornamental Furnishings</Name>
        <Product ID="Level3_75030100" UserTypeID="Level3">
          <Name>Ornaments</Name>
          <Product ID="Level4_10002231" UserTypeID="Level4">
            <Name>Ornaments</Name>
          </Product>
          <Product ID="Level4_10005692" UserTypeID="Level4">
            <Name>Ornament Accessories</Name>
          </Product>
          <Product ID="Level4_10002238" UserTypeID="Level4">
            <Name>Ornaments Variety Packs</Name>
          </Product>
          <Product ID="Level4_10002249" UserTypeID="Level4">
            <Name>Candle Holders/Accessories</Name>
          </Product>
          <Product ID="Level4_10002236" UserTypeID="Level4">
            <Name>Seasonal Decorations (Non Powered)</Name>
          </Product>
          <Product ID="Level4_10002237" UserTypeID="Level4">
            <Name>Seasonal Decorations (Powered)</Name>
          </Product>
          <Product ID="Level4_10000555" UserTypeID="Level4">
            <Name>Candles</Name>
          </Product>
          <Product ID="Level4_10002234" UserTypeID="Level4">
            <Name>Decorative Magnets/Stickers/Window Clings</Name>
          </Product>
          <Product ID="Level4_10002235" UserTypeID="Level4">
            <Name>Sun/Dream Catchers/Windchimes</Name>
          </Product>
          <Product ID="Level4_10002232" UserTypeID="Level4">
            <Name>Artificial Flowers/Plants/Trees</Name>
          </Product>
          <Product ID="Level4_10002233" UserTypeID="Level4">
            <Name>Vases</Name>
          </Product>
        </Product>
        <Product ID="Level3_75030600" UserTypeID="Level3">
          <Name>Ornamental Furnishings Variety Packs</Name>
          <Product ID="Level4_10003816" UserTypeID="Level4">
            <Name>Ornamental Furnishings Variety Packs</Name>
          </Product>
        </Product>
        <Product ID="Level3_75030200" UserTypeID="Level3">
          <Name>Pictures/Mirrors/Frames</Name>
          <Product ID="Level4_10002241" UserTypeID="Level4">
            <Name>Posters/Prints</Name>
          </Product>
          <Product ID="Level4_10002240" UserTypeID="Level4">
            <Name>Paintings</Name>
          </Product>
          <Product ID="Level4_10002243" UserTypeID="Level4">
            <Name>Photographs</Name>
          </Product>
          <Product ID="Level4_10002245" UserTypeID="Level4">
            <Name>Mirrors</Name>
          </Product>
          <Product ID="Level4_10002247" UserTypeID="Level4">
            <Name>Pictures/Mirrors/Frames Variety Packs</Name>
          </Product>
          <Product ID="Level4_10002246" UserTypeID="Level4">
            <Name>Picture Frames</Name>
          </Product>
          <Product ID="Level4_10002248" UserTypeID="Level4">
            <Name>Picture/Mirrors/Frames Other</Name>
          </Product>
        </Product>
        <Product ID="Level3_75030700" UserTypeID="Level3">
          <Name>Decorative Banners/Flags</Name>
          <Product ID="Level4_10005816" UserTypeID="Level4">
            <Name>Decorative Banners/Flags</Name>
          </Product>
        </Product>
        <Product ID="Level3_75030400" UserTypeID="Level3">
          <Name>Clocks</Name>
          <Product ID="Level4_10004101" UserTypeID="Level4">
            <Name>Clocks - Replacement Parts</Name>
          </Product>
          <Product ID="Level4_10002252" UserTypeID="Level4">
            <Name>Clocks</Name>
          </Product>
        </Product>
      </Product>
         </Product>
  </Products>
 Please suggest..

Hi RAGS1109,
If our XML data starts to get more complicated (multiple levels of elements / attributes), we start getting more outputs, we will have to join those outputs with a merge join transform.
Please refer to the following document how to dealing with multiple outputs for XML data source:
Using XML Source:
http://blogs.msdn.com/b/mattm/archive/2007/12/11/using-xml-source.aspx 
Process Multi-Level XML in SSIS:
http://www.youtube.com/watch?v=rFgLV58EcXA
If you have any feedback on our support, please click
here.
Elvis Long
TechNet Community Support

Similar Messages

  • Load XML file into oracle database

    Hi
    i have a xml file and the XSD(Schema definition file for XML). i need to load the xml file into the database.
    Can you please tell me the best approach for this ?

    There are plenty of examples of this on the XML DB Forum.
    Here is a link to the FAQ for that forum...
    XML DB FAQ

  • How to load XML files into ORACLE8i database?

    SAP data is being extracted into XML format (via IDOC) files which are being transferred to an ORACLE8i box. There will be a large amount of data transferred on a daily basis which will include updates and inserts. From all the information that I have read on this subject there are 2 options available :
    1. XML-SQL Utility - which converts XML into INSERT, UPDATE or DELETE SQL. There does not appear to be that much functionality available by this method for decodes, transformations on the input data.
    2. SQL*Loader - There was a statement in 1 piece of documentation stating that SQL*Loader could be used for loading XML format data files. I cannot however find any further information on how this is achieved or how it works.
    If anyone has any experience in loading XML format data files using either of the above methods (preferably SQL*Loader as it has more functionality) then could you please provide me with examples or guidance on this matter? Any help would be greatly appreciated as I am not familiar with XML format data files. I am from an Oracle 7.3 background but do not have much experience with Oracle 8 onwards.
    Disclaimer.
    Any views expressed in the above paragraphs are my own and not that of Hewlett Packard Ltd.

    We are loading XML into our database using CLOB datatypes. We don't use the XSU for inserts as it is too slow. We parse the incoming XML document into a PL/SQL record type and then build a generic insert. This might not work well if you have many tags to parse into columns. We also store the entire XML CLOB into a column without parsing the individual tags into separate columns. We then use Intermedia Text for fast, index-based searching within the XML column.
    Check out The Oracle XML Portal website for code examples on how to do this:
    www.webspedite.com/oracle

  • Error while loading XML files into scott user

    Hi All,
    I'm new to xml files. I need to load xml files into database through OWB.
    I have xml file in my local machine & am trying to load into table PO of Scott. Scott is registered as repository user.
    Followed same steps as specified in userguide.
    But, when executing the procedure ( in two ways one as just table name, and other as user.table name) it is showing the below error:
    Procedure is:(1)--with username.tablename
    begin
    wb_xml_load(
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>&&SAMPLES_DIR.sample1.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target dateFormat="yyyy.MM.dd">scott.PO</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    end;
    ERROR at line 1:
    ORA-20006: Error occurred while truncating target database object SCOTT.PO.
    Base exception: ORA-01031: insufficient privileges
    ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
    ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
    ORA-06512: at "SCOTT.SAMPLE1", line 3
    ORA-06512: at line 1
    Procedure is:(2) with out username
    begin
    wb_xml_load(
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>&&SAMPLES_DIR.sample1.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target dateFormat="yyyy.MM.dd">PO</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    end;
    ERROR at line 1:
    ORA-20006: Error occurred while truncating target database object PO.
    Base exception: ORA-00942: table or view does not exist
    ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
    ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
    ORA-06512: at line 2
    xml file:
    <ROWSET>
    <ROW>
    <ID>100</ID>
    <ORDER_DATE>2000.12.20</ORDER_DATE>
    <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
    <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
    <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
    <SHIPTO_STATE>CA</SHIPTO_STATE>
    <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>     
    </ROWSET>
    Note: Everything works fine if I create PO table in OWBSYS user and execute the procedurein OWBSYS user. OWBSYS.PO table will be loaded.
    What privileges are missing, what shouldI do if I want to execute the procedure from scott user and load the table of scott.
    Thanks in advance for the help.
    Regards,
    Joshna

    Hi Joshna,
    Please follow below steps to load xml file to oracle database.
    1.First connect to owb (Design Center) through your repository owner user (ex : REP_OWNER).
    2. Import WB_XML_LOAD procedure . and exit to repository owner.
    3. connect to owb design center through your repository user (ex : REP_USER)
    Create New mapping and drag one Constant Operator and create one attribute, paste / edit following code
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>E:\SOURCE\emp.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target truncateFirst = "FALSE" dateFormat="yyyy.MM.dd">rep_user.emp</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    4. Drag pre mapping operator and select WB_XML_LOAD procedure
    5. Connect Constant Operator attribute to pre mapping operator.
    6. Drag two dummy tables and connect source to target. (ex : drag t1 (table) tab two times and connect.
    7. Validate and deploy the mapping.
    8. grant necessary grant command to rep_owner user to rep_user user.
    (Note : target truncateFirst = "FALSE" by default truncate the table. So you have to give grant privileges
    To rep_user , select ,insert, delete privileges.
    9. Execute the mapping , and check EMP table. (Note : before loading EMP table delete all records ).
    10 . If you want more description please go through the below link
    http://download.oracle.com/docs/html/A95931_01/apf.htm
    Regards
    Venkat

  • Techinical issue loading an XML file in to database

    hi,
    i am trying to load an XML file into Oracle database using SSIS 2005. the XML file is huge with 4000+ columns and also has many sub catogoreys. if i try to load the file using XSD it is taking lot of space to read the entire file upto 10GB even if the data row in the file is only one. I am only loading 60 columns out of the 4000+ columns. please provide me any alternatives that you can think of.
    Thanks in advance.
    Deb

    Stew Ashton wrote:
    I think Oracle's support for loading XML data to relational tables could be improved. I haven't found a scalable solution for very large XML files that doesn't involve breaking the file up into little parts or writing / copying a good bit of code.XML DB provides two efficient ways to load XML data relationally :
    - Object-Relational storage and FTP : the file is send to the XDB repository and inserted into the default XMLType table declared during schema registration. The underlying storage structures (collections, nested tables) are loaded directly while the data source is read.
    Then it's just a matter of building views over the XMLType table to present the data relationally.
    We can process several GBs with this method.
    - Binary XML and streaming XPath evaluation : binary XML is a post-parsed format which is optimized for streaming processing, it's available since 11.1 and now the default starting with 11.2.0.2.
    and you are supposed to parse the whole thing and return any errors before actually doing anything.That's the DOM view of things.
    XML DB doesn't use DOM when documents are first stored as XMLType (binary or OR storage), or when it does, for example if a functional evaluation of XQuery is required, then a "lazy DOM" model is used where only the needed part(s) of the XML is (are) retrieved.

  • Performance problems loading an XML file into oracle database

    Hello ODI Guru's,
    I am trying to load and XML file into the database after doing simple business validations. But the interface takes hours to complete.
    1. The XML files are large in size >200 Mb. We have an XSD file for the schema definition instead of a DTD.
    2. We used the external database feature for loading these files in database.
    The following configuration was used in the XML Data Server:
    jdbc:snps:xml?f=D:\CustomerMasterData1\CustomerMasterInitialLoad1.xml&d=D:\CustomerMasterData1\CustomerMasterInitialLoad1.xsd&re=initialLoad&s=CM&db_props=oracle&ro=true
    3. Now we reverse engineer the XML files and created models using ODI Designer
    4. Similar thing was done for the target i.e. an Oracle database table as well.
    5. Next we created a simple interface with one-to-one mapping from the XSD schema to the Oracle database table and executed the interface. This execution takes more than one hour to complete.
    6. We are running ODI client on Windows XP Professional SP2.
    7. The Oracle database server(Oracle 10g 10.2.0.3) for the target schema as well as the ODI master and work repositories are on the same machine.
    8. I tried changing the following properties but it is not making much visible difference:
    use_prepared_statements=Y
    use_batch_update=Y
    batch_update_size=510
    commit_periodically=Y
    num_inserts_before_commit=30000
    I have another problem that when I set batch_update_size to value greater that 510 I get the following error:
    java.sql.SQLException: class org.xml.sax.SAXException
    class java.lang.ArrayIndexOutOfBoundsException said -32413
    at com.sunopsis.jdbc.driver.xml.v.a(v.java)
    The main concern is why should the interface taking so long to execute.
    Please send suggestions to resolve the problem.
    Thanks in advance,
    Best Regards,
    Nikunj

    Approximately how many rows are you trying to insert?
    One of the techniques which I found improved performance for this scenario was to extract from the xml to a flat file, then to use SQL*LOADER or external tables to load the data into Oracle.

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • Loading XML files into an 8.0.6 database...

    Hi,
    I've got an Oracle 8.0.6 instance (Sun E250 Solaris 5.7) with multiple import data feeds. I am currently using SQL*Loader to load this data which are flat text delimited files. My data feeds will soon be supplying XML files instead of these flat files which is great, unfortunately, I will not be able to upgrade in 8.1.7 in time so that I can use the XML parser.
    Is there anyway I can use SQL*Loader or some other tool to load XML files into my 8.0.6 database? If there is a way, could someone please send the information I would need to help perform this task?
    Thanks for all your help...
    Gerry D'Costa
    Database Administrator
    [email protected]
    12Snap.com

    Check out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
    Ben

  • Loading XML files into Database table

    Loading XML files into Database table
    Hi I have some XML files say 100 files in a virtual directory created using &quot;Create or replace directory command&quot; and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packages

    Check out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
    Ben

  • How to load XML file as is to database table  ?? CLOB

    I want to store a XML file into the database and then use
    Intermedia search facility to search the document. How can i
    achieve it. Searching the document has been pretty well
    explained. But i don't find an example showing storing a file as
    is to a table in a CLOB. If somebody can guide me it will be
    helpful. I'm new to intermedia stuff.
    I'm using oracle 8.1.7 database.
    Pls mail me at [email protected]
    Thanx in advance
    Arun

    Please check the feature of the day "Searching for content and
    structure in XML documents". Note that works with 9i.
    http://otn.oracle.com/products/oracle9i/daily/nov30.html
    I want to store a XML file into the database and then use
    Intermedia search facility to search the document. How can i
    achieve it. Searching the document has been pretty well
    explained. But i don't find an example showing storing a file as
    is to a table in a CLOB. If somebody can guide me it will be
    helpful. I'm new to intermedia stuff.
    I'm using oracle 8.1.7 database.
    Pls mail me at [email protected]
    Thanx in advance
    Arun

  • How to load XML files ? HELP!

    Hi folks.
    We have an old Oracle database 7.3..
    So we need to load XML files into its tables.
    As we understand Oracle Loader doesn't help us.
    Is the way to load that files?
    Thanks in advance
    Alex

    I know you realize 7.3 is old but this is sort of like trying trying to view a DVD when you only have a VCR. Simple answer would be buy a DVD player, i.e. upgrade to a more recent version of Oracle where you will get many features to handle XML.
    How do you want the XML loaded, all as a single object? That could be a CLOB column if 7.3 had them, I am not sure. You would probably have to write PL/SQL and something with UTL_FILE (if 7.3 had that) to load it.
    If you want to put it multiple columns based on its tags, you would be better off parsing it using PERL (or something) into a CSV and loading that in SQL*Loader.
    I assume as this is using XML it is a reasonably recent design, combining that with an ancient version of the database is just going to lead to endless headaches.

  • Loading XML file into DB Table

    Hi
    I m quite new to the loading XML file into database table.
    It will be great if anyone could guide me to through.
    Now,
    i have an XML file which has to be loaded into the DB table.
    what are the steps involved in doing this. How do i go from here ??
    your help is greatly appriciated ???
    Thank you so much!!
    -Shashi

    OK - Although you really should read the XMLDB FAQ on this forum, here is some sample code of ONE of the ways of doing it
    (there are multiple ways - and this is not the most simple one)
    Based on Oracle 11gR1
    -- sqlplus /nolog
    clear screen
    set termout on
    set feed on
    set lines 40
    set long 10000000
    set serveroutput on
    set lines 100
    set echo on
    connect / as sysdba
    col filename for a80
    col xml      for a80
    -- Create schema “OTN”
    drop user OTN cascade;
    purge dba_recyclebin;
    create user OTN identified by OTN;
    grant dba, xdbadmin to OTN;
    EXECUTE dbms_java.grant_permission( 'OTN', 'java.io.FilePermission','G:\OTN\xmlstore','read' );
    prompt pause
    pause
    clear screen
    -- Create directory
    connect OTN/OTN;
    show user
    drop directory OTN_USE_CASE;
    CREATE directory OTN_USE_CASE AS 'G:\OTN\xmlstore';
    SELECT extract((XMLTYPE(bfilename('OTN_USE_CASE','ABANDA-20030407215829881GMT.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from   dual;
    prompt pause
    pause
    clear screen
    -- Directory Listing - Tom Kyte
    create global temporary table DIR_LIST
    ( filename varchar2(255) )
    on commit delete rows
    create or replace
      and compile java source named "DirList"
    as
    import java.io.*;
    import java.sql.*;
    public class DirList
    {public static void getList(String directory)
                       throws SQLException
    {   File path = new File( directory );
        String[] list = path.list();
        String element;
        for(int i = 0; i < list.length; i++)
        {   element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    create or replace procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    prompt pause
    pause
    clear screen
    -- The content of the global temporary table
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list;
    -- "COMMIT" will clear / truncate the global temporary table...
    prompt pause
    pause
    clear screen
    -- Combined: Reading XML content from multiple XML files
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select * from dir_list where filename like '%.xml'
    and rownum <= 10;
    prompt pause
    pause
    clear screen
    select extract((XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8'))),'*') AS "XML"
    from dir_list dl
    where dl.filename like '%.xml' and rownum <= 2;
    prompt pause
    pause
    clear screen
    -- If you can select it you can insert it...
    -- drop table OTN_xml_store purge;
    create table OTN_xml_store of xmltype
    xmltype store as binary xml
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    set time on timing on
    insert into OTN_xml_store
    select XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
    from dir_list dl
    where dl.filename like '%.xml';
    set time off timing off
    commit;
    select count(*) from OTN_xml_store;
    prompt pause
    pause
    clear screen
    -- If you can select it you can create resources and files
    set time on timing on
    commit;
    exec get_dir_list( 'G:\OTN\xmlstore' );
    select count(*) from dir_list where filename like '%.xml';
    set serveroutput on size 10000
    DECLARE
    XMLdoc XMLType;
    res BOOLEAN;
    v_foldername varchar2(4000) := '/public/OTN/';
    cursor c1
    is
    select dl.filename FNAME
    , XMLTYPE(bfilename('OTN_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
    from dir_list dl
    where dl.filename like '%.xml'
    and rownum <= 100;
    BEGIN
    -- Create XDB repository Folder
    if (dbms_xdb.existsResource(v_foldername))
    then
    dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
    end if;
    res:=DBMS_XDB.createFolder(v_foldername);
    -- Create XML files in the XDB Repository
    for r1 in c1
    loop
    if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
    then
    dbms_output.put_line(v_foldername||r1.fname);
    null;
    else
    dbms_output.put_line('Loop Exception :'||sqlerrm);
    end if;
    end loop;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line('Others Exception: '||sqlerrm);
    END;
    set time off timing off
    commit;
    prompt pause
    pause
    clear screen
    -- FTP and HTTP
    clear screen
    prompt
    prompt *** FTP - Demo ***
    prompt
    prompt pause
    pause
    host ftp
    -- open localhost 2100
    -- user OTN OTN
    -- cd public
    -- cd OTN
    -- ls
    -- bye
    clear screen
    prompt
    prompt *** Microsoft Internet Explorer - Demo ***
    prompt
    prompt pause
    pause
    host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OTN:OTN@localhost:8080/public/OTN/
    prompt pause
    pause
    -- Accessing the XDB Repository content via Resource View
    -- Selecting content from a resource via XBDUriType
    clear screen
    prompt set long 300
    set long 300
    prompt Relative Path - (path)
    SELECT path(1) as filename
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 10
    prompt pause
    pause
    clear screen
    prompt Absolute Path - (any_path)
    select xdburitype(any_path).getClob() as xml
    FROM RESOURCE_VIEW
    WHERE under_path(RES, '/public/OTN', 1) = 1
    and rownum <= 1;
    prompt pause
    pause
    -- CLEANUP ENVIRONMENT
    clear screen
    prompt
    prompt >>>>> Clean UP !!! <<<<<<
    prompt
    prompt Cleanup environment and drop user...!!!
    prompt
    pause
    clear screen
    conn / as sysdba
    alter session set current_schema=OTN;
    begin
    dbms_xdb.deleteResource('/public/OTN',dbms_xdb.DELETE_RECURSIVE_FORCE);
    commit;
    end;
    alter session set current_schema=sys;
    drop user OTN cascade;
    Based on http://www.liberidu.com/blog/?p=1053

  • How to load XML file to DB

    Hi All,
    My requirement is I have a XML file, its data should be stored in Database.
    Below is the sample XML file.
    <?xml version="1.0"?>
    <PaymentInfoMessageResponse>
    <PaymentInfoResponse>
    <TransactionType>940</TransactionType>
    <SequenceNum>04</SequenceNum>
    <CompanyCode>902</CompanyCode>
    </PaymentInfoResponse>
    <StatusCode>OK</StatusCode>
    <StatusDetail>OK</StatusDetail>
    <ResponseItemCount>2</ResponseItemCount>
    </PaymentInfoMessageResponse>
    I have a table with columns name say TransType,SeqNum
    the value 940,04 from XML file should be saved in TransType,SeqNum Column respectively
    I am using file adapter with native format builder,selecting file type as complex type and
    In design schema,I'm not able to proceed,i'm getting error in POP up as:
    Native Format builder:error
    No global elements exist.
    How can i proceed or any other way to load XML file to DB.
    urgent Help/suggestion is required.
    Thanks in advance

    HI all,
    1)If my input is .txt file.
    we can use file adapter,using native builder,sample it,
    delimited/fixed length, we can do normal file read and file write/DB write.It works fine.
    2)If my input file is xml file,we can't use native builder format(Because it doesn't support
    delimited/fixed length/complex character in native format builder).
    so,as said in the above reply,i took a sample XML file & converted to XSD using
    File Menu > New > All Technologies tab > General > XML > XML Schema from XML Document.
    It compiles fine.
    Now,if i use file adapter(read) -- BPEL -- File adapter(write).
    Inside Transform,i am mapping filereadVariable and filewrite Variable correctly.
    If my input file is Abc.xml and its contents in read file are:
    <?xml version="1.0"?>
    <PaymentInfoMessageResponse>
    <PaymentInfoResponse>
    <TransactionType>940</TransactionType>
    <SequenceNum>04</SequenceNum>
    <CompanyCode>902</CompanyCode>
    </PaymentInfoResponse>
    <StatusCode>OK</StatusCode>
    <StatusDetail>OK</StatusDetail>
    </PaymentInfoMessageResponse>
    In write folder,my contents are
    <PaymentInfoMessageResponse>
    <imp1:PaymentInfoResponse>
    <imp1:TransactionType/>
    <imp1:SequenceNum/>
    <imp1:ReceiptTime/>
    <imp1:CompanyCode/>
    </imp1:PaymentInfoResponse>
    <imp1:StatusCode/>
    <imp1:StatusDetail/>
    </PaymentInfoMessageResponse>
    Now,if i use file adapter(read) -- BPEL -- DB adapter(merge).
    Inside Transform,i am mapping filereadVariable and DBmerge Variable correctly.
    If my input file is Abc.xml and its contents in read file are:
    <?xml version="1.0"?>
    <PaymentInfoMessageResponse>
    <PaymentInfoResponse>
    <TransactionType>940</TransactionType>
    <SequenceNum>04</SequenceNum>
    <CompanyCode>902</CompanyCode>
    </PaymentInfoResponse>
    <StatusCode>OK</StatusCode>
    <StatusDetail>OK</StatusDetail>
    </PaymentInfoMessageResponse>
    My output in em console is like this.
    <CeStatementHeadersIntCollection>
    <top:CeStatementHeadersInt>
    <top:statementNumber/>
    <top:bankName/>
    </top:CeStatementHeadersInt>
    </CeStatementHeadersIntCollection>
    NO data is being inserted into DB.
    I can write my XMl file into write folder as it is using opaque object(No native format translation)
    I can write XML file into DB using BLOB data type.
    But my requirement is:
    I have a table with columns name say TransType,SeqNum
    the value 940,04 from above XML file should be saved in TransType,SeqNum Columns respectively.
    Can i do it using DOM parser/SAX parser?
    So any suggestion/help required
    Thanks in advance

  • Load XML file to XMLTable from FTP site Problem Oracle9i Release 9.2.0.7.

    Hi,
    I was wondering if it is possible to load XML file from FTP address directly to XMLType Table?
    Can someone help me?
    For example I have ftp site "ftp://test" and on this site I have file "file.xml"
    and I would like to load "file.xml" to table "xml_tab" ?
    I tried to use "load_xml" procedure and set DIRECTORY "xml_dir" to 'ftp://test' but I get this error
    exec load_xml(p_dir=>'XML_DIR', p_filename=>'file.xml');
    ERROR at line 1:
    ORA-22288: file or LOB operation FILEOPEN failed
    The network path was not found.
    ORA-06512: at "SYS.DBMS_LOB", line 504
    ORA-06512: at "P.LOAD_XML", line 8
    ORA-06512: at line 1
    Procedure looks like this:
    (p_dir IN VARCHAR2,
    p_filename IN VARCHAR2) AS
    l_bfile BFILE := BFILENAME(p_dir, p_filename);
    l_clob CLOB;
    BEGIN
    DBMS_LOB.createtemporary (l_clob, TRUE);
    DBMS_LOB.fileopen(l_bfile, DBMS_LOB.file_readonly);
    DBMS_LOB.loadfromfile(l_clob, l_bfile, DBMS_LOB.getlength(l_bfile));
    DBMS_LOB.fileclose(l_bfile);
    INSERT INTO xml_tab (
    id,
    filename,
    xml
    VALUES (
    xml_tab_seq.NEXTVAL,
    p_filename,
    XMLTYPE.createXML(l_clob)
    COMMIT;
    DBMS_LOB.freetemporary (l_clob);
    END;
    I have tried also with this
    select xdburitype('ftp://test/file.xml').getCLob() from dual;
    but i get error
    ERROR:
    ORA-31001: Invalid resource handle or path name "ftp://test/file.xml"
    Can you pleeeeeeas show me a way to do this, thanks ???

    This will not work.. Ypu cannot use FTP to 'PULL' a document into the database. (Yes I know there's a placeholder for an FTPURITYPE() but it was never implemented).
    However you can use an FTP client to PUSH content into the XML DB repository. If the content is schema based XML associated with a known (registered) XML schema the content of the file will automatically be stored in the default table associated with the root element of the file. If the content is not associated with an known XML schema you can then use xdburitype to read the resource that was created when the document was uploaded into the repository

  • 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.

Maybe you are looking for

  • LCCS and Flex 4.5

    Hello, I'm about to start a new project, that will make use of LCCS, and I'm deciding which SDK should I use between Flex 4.1 and Flex 4.5. Provided I pick the LCCS for Flash Player 10.1 library (the lastest stable), is there any know problem or inco

  • No Sound in Gnome 3.2

    Just upgraded and sounds are disappear. pulseaudio + alsa.

  • Limiting spry:repeatchildren in a list

    I have found a number of entries on the forums relating to limiting the number of dynamically produced table rows from a spry:repeat but nothing on limiting the number of list items in a list. So put basically: I have an XML file with 10 items, but I

  • SCCM 2012 Proof %appdata%

    Hello, i wnat to copy some settings to the current logged user within an application package. The proofing should check if the file is store under %appdata% folder of the users. I added this as check in Apllication but it failes

  • Adobe reader install fails and video blanks

    Had to reinstall XP due to Trojan problem.  Now I am unable to reinstall either Flash or Reader.  Download is ok but install only gets half way before blanking the video.  The monitor status goes to yellow.  Other aps have been downloaded and install