Idea of conversion xml to sql

Hi, I'm a student
I need to write a java program, which can convert any XML file to SQL database (i.e. MySQL, Postgres).
BUT
I don't have any idea, how to do that. Because XML files can be quite complex: i.e:
<a>
      <b>
              <c>
               Something here
              </c>
     </b>
</a>My idea is: <a > is table in database, <b > is column, and <c > ...... Exactly! WHAT TO DO with tags which deepth is greater than three?
Any suggestions? Plz help

Why do you wanna represent sql with xml? Do you wanna create an structure to do you queries more easily? i dont know if that's the best way out... but here's an ideia of how you could do it:
<sql>
<operation name="SELECT">
    <item>
        <table>table name</table>
        <field>field name</field>
    </item>
</operation>
<operation name="FROM">
    <item>
        <table>table name</table>
    </item>
</operation>
<operation name="WHERE">
    <item>
        <table>table name</table>
        <field>field name</field>
        <value>value of the field</value>
    </item>
    <item>
        <table>table name</table>
        <field>field name</field>
        <joinTable>the join table</joinTable>
        <joinField>the join field</joinField>
    <item>
</operation>
<operation name="ORDER BY">
</operation>
</sql>

Similar Messages

  • XML conversion in pl/sql

    hi ,
    How do i map the xml handling code in t-sql to pl/sql??
    for example , here is the t-sql code :
    CREATE PROCEDURE [dbo].[usp_LIBRARYHideUnhideTreeNodes]
         -- Add the parameters for the stored procedure here
         @paramMyXml text,
         @XmlHandle int output
    AS
    BEGIN
         -- SET NOCOUNT ON added to prevent extra result sets from
         -- interfering with SELECT statements.
         SET NOCOUNT ON;
    /*Update statements*/
         EXEC sp_xml_preparedocument @XmlHandle output,@paramMyXml
         UPDATE LIBRARYTree SET IsVisible = ~IsVisible WHERE NodeId in(
         SELECT xNodeID FROM OPENXML (@XmlHandle, 'HiddenNodes/Node',1)
         WITH ( xNodeID int '@id'))
         EXEC sp_xml_removedocument @XmlHandle
    END
    The corresponding code in pl/sql by sql developer is :
    CREATE OR REPLACE PROCEDURE usp_LIBRARYHideUnhideTreeNodes
    -- Add the parameters for the stored procedure here
    v_paramMyXml IN CLOB DEFAULT NULL ,
    v_XmlHandle OUT NUMBER
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    NULL/*TODO:SET NOCOUNT ON*/;
    /*Update statements*/
    sp_xml_preparedocument(v_XmlHandle,
    v_paramMyXml);
    UPDATE LIBRARYTree
    SET IsVisible = UTL_RAW.BIT_COMPLEMENT(IsVisible)
    WHERE NodeId IN ( SELECT xNodeID
    FROM DUAL/*TODO:OPENXML (@XmlHandle, 'HiddenNodes/Node',1)
    WITH ( xNodeID int '@id'))*/ );
    sp_xml_removedocument(v_XmlHandle);
    END;
    This on compilation for obvious reasons gives errors.
    how is sp_xml_preparedocument,openxml,sp_xml_removedocument handled in pl/sql??
    any help in this direction will be appreciated..
    Cheers,
    Shishir.

    Can you brief what you want to do? You don't need to do statement by statement conversion from t-sql to PL/SQL. This is not translation.

  • How to generate XML from SQL query

    possible ways to generate XML from SQL qury.
    i want to generate XML of following query. "Select * from emp,dep wher emp.deptno=dept.deptno"

    Hello.
    Can you try:
    SQL> set pages 0
    SQL> set linesize 150
    SQL> set long 9999999
    SQL> set head off
    SQL> select dbms_xmlgen.getxml('Select * from emp,dep wher emp.deptno=dept.deptno') from dual;
    It works fine for me.
    Octavio

  • VIEW XML IN SQL*PLUS

    how can we view xml on sql*plus?
    when xmltype is viewed on sql*prompt it shows incomplete xml.
    example:
    SQL> select xmlelement("ROOT",xmlforest(1 as A, 2 as B, 3 as C)) from dual;
    XMLELEMENT("ROOT",XMLFOREST(1ASA,2ASB,3ASC))
    <ROOT>
    <A>1</A>
    <B>2</B>
    <C>3</C>
    </ROOT>
    but i generate an xml from table so it becomes quite huge. say a forest is populated with 6-8 tags. it shows broken output.
    SQL> /
    ID LIST
    <DEPT>
    <EMPLOYEE>
    <ID>2109</ID>
    <ID>3108</ID>
    <ID>4107</ID>
    <ID>5106</ID>
    <ID
    i have tried increasing bufferwidth and bufferlength tp max value (1000 and 2000 respectively) eventhen it displays the output as shown above.
    how can i view my xml?

    use this sql plus command:
    set long 2000000
    You can increase\decrease the value as required.

  • Peter Fabian from Ottawa – Wants to learn XML and SQL

    Hi There,
    I am Peter Fabian from Ottawa. I want to learn XML and SQL. I have basic knowledge of HTML. Please provide me necessary tutorial which can help me to learn XML and SQL.
    Thanks
    Peter Fabian

    Some starting points based on existing Oracle documentation
    [url http://www.oracle.com/technetwork/indexes/documentation/index.html]Oracle Documentation
    SQL - [url http://docs.oracle.com/cd/E11882_01/appdev.112/e10766/toc.htm]2 Day Developer&apos;s Guide
    XML DB - [url http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb01int.htm#ADXDB0100]XML DB Developer&apos;s Guide
    If you are going for the basics of XML, here is a place to start at [url http://www.w3schools.com/xml/]XML Tutorial
    You can also just google for tutorials on both SQL and XML and find the basics as well.

  • Generating XML from SQL queries and saving to an xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

    If you are using 9iR2 you do not need to do any of this..
    You can create an XML as an XMLType using the new SQL/XML operators. You can insert this XML into the XML DB repository using DBMS_XDB.createResource. You can then access the document from the resource. You can also return the XMLType containing the XML directly from the PL/SQL Procedure.

  • Generating XML from SQL queries and saving to a xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a stored procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

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

  • XML or Sql or ??

    Hi
    I'm developing my first app for iOS using Flashbuilder 4.6 and need to have a database to keep track of certain items, probably no more than 20 items per record (including username and password) in a single table for a single user. 
    I don't want to use server technology but want to keep the data on the device.   My question is should I use XML or SQL or some other way to store the data on the device.
    Any guidance would be appreciated.
    Thanks.

    Ok ... drop sitemesh and jmeter. So we have:
    mysql + hibernate + log4j + ant + struts + tomcat (app server) + apache (web server) running on freebsd and tested using junit.
    mysql - Half decent and free. Easy to setup.
    hibernate - Provides OR mapping. Takes a bit of learning but keep it simple and you'll be ok.
    log4j - Really easy to setup and use.
    ant - Again will take a bit of learning but once you get going you can write a basic ant script in no time (it integrates really well with eclipse)
    struts - Probably the most difficult technology to learn but it will keep your app well structured. (MVC)
    tomcat + apache - You can probably get away with just tomcat but if you've got time use the jk2 connector stuff.
    freebsd - Any unix based OS will do really.
    junit - Will look really good if you show you've properly unit tested your work. And you can integrate with junit with ant.
    How long have you got to do this btw ...

  • Generic XML to SQL translator

    We are working on a project where we need to push blobs of XML data into a DB with an unknown schema. We are looking for a tool that defines it's own XML-to-SQL protocol that would allow it to accept XML data in a format known to it and then translate it into SQL statements to store the info. Our thought is to take the data in our "internal" XML format and supply an XSL document to translate to whatever the end schema is. So if we had this data:
    <MyDataObject>
    <Member1>foo</Member1>
    <Member2>bar</Member2>
    </MyDataObject>
    the XSL would translate it into a format that the tool would understand, like:
    <Table name=DataObjects>
    <Column name=Member1>foo</Column>
    <Column name=Member2>bar</Column>
    </Table>
    the tool would then know to create an INSERT statement to add this data to the DataObjects table. The key is that we don't know the name or setup of any of the tables or columns at compile time. These may vary at each installation. It's easy to provide a new XSL translation for each install. It's harder (i.e. not feasible) to write whole new classes to match each schema.
    The normal "XML to DB" tools/architectures like Castor, Torque, and JDOs don't seem to support this sort of dynamic binding to a DB. Does anyone know of a tool that does, or do we have to write our own?
    Thanks,
    Eric

    Why don't you translate the XML directly to an SQL statement or use XSL to generate the SQL?
    Franco

  • XML to SQL (oracle) Parallel Processing Scenario

    hi,
    I have one scenario to load datas from XML to SQL but when this scenario runs in parallel duplicate information.
    I have done tests with 5 xml file these xml file have unique header_id but when run in parallel , insert 5 record in target table but one is repeat.
    the flow is the following,
    1. My scenario recieved one variable (name xml file), this variable is sent for bpel.
    2. Load datas from xml to sql(oracle), in this step I have concatenated to tables C$_, I$ and E$_ the session number how explain this link http://odiexperts.com/?p=1417.
    3. Invoke web service with status finished.
    I have tried the following.
    after of first step I set a procedure with sentence "SYNCHRONIZE schema SO from file" and modify my topology to &ro=true some time run perfect but check the target table and datas are duplicated and other time catch the error ....
    0 : null : java.sql.SQLException: class org.xml.sax.SAXException
    class java.lang.NullPointerException said null.
    Any suggestion o coment to execute my scenario in parallel?
    Thanks a lot.
    Antonio

    Please repost in the Data Integrator forum Data Integrator
    (this forum is for Data Service Integrator - an entirely different product).

  • Generate XML from SQL

    Hi I wan to create XML from SQL using XMLElement and XMLAttribute as per below Format
    *<field name="AccountNumber">TEST01</field>*
    is it possible?
    Thanks in advance
    waiting for yours positive reply

    Parth Panjabi wrote:
    Thanks in AdvanceWhy don't you open Oracle docs and read it. If you want to beautify, XMLSerialize supports INDENT:
    SQL> SELECT XMLSerialize(document
      2           XMLElement("ROWS",
      3             XMLAgg(
      4               XMLElement("ROW",
      5                 XMLElement("field",
      6                   XMLAttributes('AccountNumber' AS "name")
      7                 , ename
      8                 )
      9               , XMLElement("field",
    10                   XMLAttributes('CBAccountNumber' AS "name")
    11                 , null
    12                 )
    13               )
    14             )
    15           )
    16         )
    17  FROM EMP
    18  WHERE deptno = 10
    19  /
    XMLSERIALIZE(DOCUMENTXMLELEMENT("ROWS",XMLAGG(XMLELEMENT("ROW",XMLELEMENT("FIELD
    <ROWS><ROW><field name="AccountNumber">CLARK</field><field name="CBAccountNumber
    "></field></ROW><ROW><field name="AccountNumber">KING</field><field name="CBAcco
    untNumber"></field></ROW><ROW><field name="AccountNumber">MILLER</field><field n
    ame="CBAccountNumber"></field></ROW></ROWS>
    SQL> SELECT XMLSerialize(document
      2           XMLElement("ROWS",
      3             XMLAgg(
      4               XMLElement("ROW",
      5                 XMLElement("field",
      6                   XMLAttributes('AccountNumber' AS "name")
      7                 , ename
      8                 )
      9               , XMLElement("field",
    10                   XMLAttributes('CBAccountNumber' AS "name")
    11                 , null
    12                 )
    13               )
    14             )
    15           )
    16          INDENT
    17         )
    18  FROM EMP
    19  WHERE deptno = 10
    20  /
    XMLSERIALIZE(DOCUMENTXMLELEMENT("ROWS",XMLAGG(XMLELEMENT("ROW",XMLELEMENT("FIELD
    <ROWS>
      <ROW>
        <field name="AccountNumber">CLARK</field>
        <field name="CBAccountNumber"/>
      </ROW>
      <ROW>
        <field name="AccountNumber">KING</field>
        <field name="CBAccountNumber"/>
      </ROW>
      <ROW>
        <field name="AccountNumber">MILLER</field>
    XMLSERIALIZE(DOCUMENTXMLELEMENT("ROWS",XMLAGG(XMLELEMENT("ROW",XMLELEMENT("FIELD
        <field name="CBAccountNumber"/>
      </ROW>
    </ROWS>
    SQL>
    {code}
    SY.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • XML to SQL conversion using OracleXML putXML

    Hi,
    How many rowTag values can I use when I use OracleXML putXML ? I have an XML file in the following format.
    I have to use "ABC" as rowTag. What Can I do with "GRANT_ROW" ? I have a table with
    R_DATE and
    GRANT columns
    where GRANT is an object type with elements
    NAME and ATYPE.
    Thanks.
    <?xml version = '1.0'?>
    <EXCH>
    <ABC num="1">
    <R_DATE>5/21/2003 0:0:0</R_DATE>
    <GRANT>
    <GRANT_ROW num="1">
    <NAME>GUNACAR</NAME>
    <ATYPE>TE</ATYPE>
    </GRANT_ROW>
    <GRANT_ROW num="2">
    <NAME>GUNACAR</NAME>
    <TYPE>TE</TYPE>
    </GRANT_ROW>
    </GRANT>
    </ABC>
    </EXCH>
    I get the following error when I run
    java OracleXML putXML ....
    oracle.xml.sql.OracleXMLSQLException: 'The XML element tag 'GRANT_ROW'
    does not match the name of any of the columns/attributes of the
    target database object.' encountered during processing ROW element 0.
    Thanks....

    RTF FormattingKit
    http://www.schema.de/sitehtml/site-e/xmlnach0.htm

  • XML PL/SQL Parser Demo Error ORA-29516

    I'm trying to get the XML Plsql demo to work on the following
    system:
    Sun Solaris 8
    Oracle 8.1.7.0.0 64 bit
    using the $ORACLE_HOME/xdk/plsql/demo files
    I created an oracle user "xmldba" , granted javauserpriv to
    xmldba, granted javasyspriv to xmldba. I have run
    $ORACLE_HOME/xdk/plsql/parser/bin/load.sql. Then I try the
    demo -
    oracle8$ sqlplus xmldba/xmldba
    SQL*Plus: Release 8.1.7.0.0 - Production on Fri Nov 16 11:07:44
    2001
    (c) Copyright 2000 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.7.0.0 - 64bit Production
    With the Partitioning option
    JServer Release 8.1.7.0.0 - 64bit Production
    SQL> @domsample
    Procedure created.
    No errors.
    SQL> execute domsample
    ('/home/oracle8/app/oracle/product/8.1.7/xdk/plsql/demo','family.
    xml','errors.txt');
    BEGIN domsample
    ('/home/oracle8/app/oracle/product/8.1.7/xdk/plsql/demo','family.
    xml','errors.txt'); END;
    ERROR at line 1:
    ORA-29516: Aurora assertion failure: Assertion failure at
    joncomp.c:127
    jtc_active_clint_init_ncomp_slots(oracle/xml/parser/v2/DTD, 0)
    returned 0
    ORA-06512: at "XMLDBA.XMLPARSERCOVER", line 0
    ORA-06512: at "XMLDBA.XMLPARSER", line 57
    ORA-06512: at "XMLDBA.DOMSAMPLE", line 72
    ORA-06512: at line 1
    Anyone have any ideas on what I might be missing or what could
    cause the problem?
    Thanks,
    Rhea

    These errors were due to not running initjvm etc. I have resolved all the jvm sqlj related problems now .
    I am still seeing resolver errors . Opened a new thread for those errors.
    Please respond on those
    Thanks
    null

  • Issues passing XML to SQL*Plus in UNIX

    Oracle 10.2.0.3.0
    For some reason I can't seem to figure this out.
    This is my PL/SQL script (load_table.sql):
    SET SERVEROUTPUT ON
    SET VERIFY OFF
    DECLARE
      v_clob CLOB;
    BEGIN
      v_clob := '&1';
      INSERT INTO rh_page (pageid, pagecontent)
      VALUES ('&2', XMLTYPE(v_clob));
      COMMIT;
    END;
    EXIT;
    It is executed by this shell script (load_table.sh):
    #!/usr/bin/ksh
    . $HOME/envfile
    USERID=myUserID/myPassword
    XMLDATA=`cat test_file.xml`
    FILENAME="TestFile"
    LOG_FILE=load_table.log
    sqlplus $USERID << EOF > ${LOG_FILE}
    @ load_table.sql ${XMLDATA} ${FILENAME}
    exit 0
    Here is a sample of the XML:
    <?xml version="1.0" encoding="utf-8" ?>
    <Page>
            <PageName></PageName>
            <Title></Title>
            <Roles>-1</Roles>
            <Controls>
                    <PageTool>
                            <visible>false</visible>
                    </PageTool>
                    <divTopLeft>
                            <visible>true</visible>
    </Page>
    After I execute load_table.sh, I see that load_table.log contains the following error:
    SQL> SQL> DECLARE
    ERROR at line 1:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00007: unexpected end-of-file encountered
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    ORA-06512: at line 9Any ideas on what is causing this error or how to resolve?

    I understand this is probably not the best approach; however, I was in the process of automating the process of reading multiple XML files and loading their content to a table. Since I don't have DB privelges to set up External Tables or utilize UTL_FILE, I was trying this approach to simply direct the contents of an XML file into a UNIX shell script variable, and then pass it on as a SQL*Plus substitution variable.
    I originally did this manually, by opening each of the 40+ files and copying/pasting their content to set a CLOB variable in a PL/SQL block...now I'm just trying to figure a way to automate the same manual steps.

  • How can I load this XML with sql loader ?

    Hi,
    Im try to load a XML file into a XML table:
    Create table TEST of XMLTYPE;
    XML file is something like this:
    <!DOCTYPE list SYSTEM "myfile.dtd">
    <list>
    <item id = 1> lot of tags an info here </item>
    <item id = 9000> lot of tags an info here </item>
    </list>
    I dont know how to exactly create an appropriate control file to my XML. All examples I saw in documentation are similar to this one:
    this is an example control file
    LOAD DATA
    INFILE *
    INTO TABLE test
    APPEND
    XMLTYPE (xmldata)
    FIELDS
    I dont know how to complete this control file. Can anyone help me ?
    thank you!
    Message was edited by:
    pollopolea

    Well I found this working code
    LOAD DATA
    INFILE *
    INTO TABLE test APPEND
    xmltype(xmldata)
    FIELDS
    ext_fname filler char(30),
    xmldata LOBFILE (ext_fname) TERMINATED BY EOF
    BEGINDATA
    mifile.xml
    mifile2.xml
    mifile3.xml
    the main diference I found is that when i use:
    Insert into test values (XMLType(bfilename('XMLDIR', 'swd_uC000025127.xml'),nls_charset_id('AL32UTF8')));
    tag <!DOCTYPE list SYSTEM "myfile.dtd"> is expanded
    (I explain at DTD insertion and errors with long DTD entities
    Now using sql loader the tag is not modified.
    I dont know if is there any difference, between each case. did I lost performance?
    Message was edited by:
    pollopolea

Maybe you are looking for

  • Is There Way To RESET A Called PDF In Reader9?

    Is there a way to RESET all form fields in a called PDF? I wish to clear all form fields in the called PDF "Client File", as opened in the sample below. var otherDoc = app.openDoc("../Setup/Client File", this);

  • Is there a hotkey to go between full-screen apps?

    I have multiple full-screen apps.  Is there a way to switch between them via the keyboard?  In the old day, I could assign Spaces desktop to a hotkey, and jump to it.  That's preserved for multiple desktops in Lion OS X, but it doesn't seem to work o

  • Core dump in _ti_mutex_unlock

    Greetings, I am using compiler (Sun C++ 5.5 2003/03/12 on a Sun/SunOS 5.8 system and I am getting the following traceback. Does anybody know what pacth I need to install to get around this issue? I though I had installed all the specified patches for

  • How to find if an error log table is related to a table....???

    Hi, In Oracle 10g , maybe in older version too, there is the capability to create an error log table using the dbms_errlog package and create_error_log procedure... For exaample: exec dbms_errlog.create_error_log('EMP','EMP_ERROR') How to find afterw

  • WHY java.sql.SQLException: Invalid column index?

    DataBase db=new DataBase(); db.initialize(); PreparedStatement pstmt; //The code above is to connect the database and I am sure that there is no problem. try{ pstmt = db.conn.prepareStatement("INSERT INTO USERS VALUES"); String ID="sasdf"; String PAS