Querying node value(s) from XML insde a varchar2 column

CREATE TABLE "DEV1"."LOG" (
"LOG_ID" NUMBER(10,0) NOT NULL,
"LOG_DATA" VARCHAR2(1000 BYTE) NULL)
SAMPLE LOG_DATA COLUMN DATA:
<Log>
<PartNumbers>13000,15000</PartNumbers>
<OrderID>221</OrderID>
<OrderDateTime>01/01/2013 22:32:43</OrderDateTime>
<UserName>testUser</UserName>
<ZipCode>12345</ZipCode>
<TrackingID>333444555</TrackingID>
</Log>     
SELECT x.OrderID
FROM DEV1.LOG
,xmltable('/Log'
passing LOG.LOG_DATA
columns OrderID char(100)     path './OrderID'
) x
ERROR
ORA-00932: inconsistent datatypes: expected - got CHAR
No matter what datatype I put after "columns OrderID" I get this error. How can I get the data?

instead of
passing log.log_datatry
passing XMLTYPE(log.log_data)

Similar Messages

  • Dynamically create Value Objects from XML file

    Hi
    I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.

    Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.

  • Getting Node Value of an XML document in JAVA.

    Hi,
    In my application, I have got the exact node that I want by parsing the document, but the node value returned is null as the node is an element and the Java Documentation does specify that it will return null. I would like to know if there in any alternative way by which I can parse the document and get the specified value of the node or element. Kindly Help.

    Well, there are not many mind readers on this forum.
    You do not tell us how you are parsing the document, and so it is difficult determining why the node value is returned as a null.
    There are two main styles of processing XML -- DOM and SAX. Dom (and its variants JDom and I think Dom4J) build a tree structure that is memory-resident. There are ways to walk up and down the tree, and locate arbitrary nodes in the tree.
    The other style is SAX, which is much less intensive from a memroy perspective, but puts more work on you to keep what you want as the data goes flying by.
    So, how are you "parsing the document" and what method is returning a null? That may give someone enough information to guess at your problem.
    Dave Patterson

  • Getting Node Value of an XML element in JAVA.

    Hi,
    In my application, I have got the exact node that I want by parsing the document, but the node value returned is null as the node is an element and the Java Documentation does specify that it will return null. I would like to know if there in any alternative way by which I can parse the document and get the specified value of the node or element. Kindly help.

    Hi,
    i am using the dom parser. My code is as follows.
    Document xmlDocument, outputDoc;
                   DocumentBuilderFactory dbfObject = DocumentBuilderFactory.newInstance();
                   DocumentBuilder dbObject = dbfObject.newDocumentBuilder();
                   xmlDocument =  dbObject.parse("IPD_Response.xml");
                   Element dd = xmlDocument.getDocumentElement();
                   NodeList ItemAttributes = dd.getElementsByTagName("Element Name");
                   System.out.println("element" + ItemAttributes.item(0));
                   Node ss = ItemAttributes.item(0);
                   NodeList bb = ss.getChildNodes();
                   Node cc = ss.getFirstChild();
                   System.out.println("element sibling1 "+bb.item(0));
                   System.out.println("element sibling 2"+bb.item(1));
                   System.out.println("element sibling 3"+bb.item(2));
                   System.out.println("element child "+cc);
                   Node aa = bb.item(0);
                   NodeList qqq = aa.getChildNodes();
                   System.out.println("element sibling1---1 "+qqq.item(0));
                   System.out.println("element sibling1---1 "+qqq.item(1));
                   Node fff = qqq.item(0);
                   Node aaa = qqq.item(1);
                   String value1 = fff.getNodeValue();
                   String value2 = aaa.getNodeValue();
                   System.out.println("1st value "+value1+" 2nd value "+value2);What my code does is gets all the elements within a particular tag. After that i look for the child nodes, which i have done successfully. But when i get the value using getNodeValue(); method it will be null as per the Java Docs. Is there any other way by which i can get the node value. Kindly help.
    How do you parse the XML Document ?
    Are you using a DOM Document ?
    Which parser do you use ?
    How do you access the Element ?
    Post the releveant part of the code and using the
    [code ]  tags as described in[url=http://forum.java.sun.com/help.jspa?sec=formattin
    g]Formatting tips
    andi

  • Create value object from xml

    So I've got a value object with 100 fields.
    I have a ASP.net web service that returns the value objects
    as XML (I really don't want to use WebOrb...).
    I don't want to write a lot of code like this:
    vo.Field1 = voXML.Field1;
    vo.Field2 = voXML.Field2;
    vo.Field3 = voXML.Field3;
    Is there an easier/faster way to do this? Can't I do some
    sort of for/each loop. The element names are identical to the field
    names.
    Thanks.

    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Live Docs_Book_Parts&file=usingas_053_9.html#220936

  • Insert data from XML in a BLOB column to a table

    I have a situation where my source table has a blob column and an XML file is loaded into it.
    Whenever an insert into the table happens I need to read the XML and insert the values from XML to a target table .
    I have done it with oracle inbuilt parser and tokens but this will do a call to the database when already the data is available on the extract file.That would mean a lower performance .
    Can someone help me maybe with some userexit or something
    Thanks in advance

    Please check if you can see the 'DBMS_XMLSAVE' object in all_objects.

  • Storing a Non Printable -from keyboard- Character in Varchar2 Column

    Hi,
    I want to store a non-printable character in a varchar2 column. This character should be non-printable -from keyboard- for all character sets -or very difficult to print from keyboard-. It doesn't matter, whether it can be displayed on screen or not. It does matter INSTR function returns the character position of that character. It should be able to import export data without any problem for any NLS specific operating environment. For example, I plan to use chr(1) do you think it's appropriate? I appreciate your helps.
    Best Regards,
    Salim

    What is the business requirement you're trying to satisfy?
    If your database character set is based on ASCII, CHR(1) (the Start of Header) character is likely to be transferred between systems without character set conversion. Non-ASCII character sets (i.e. Big5 for Chinese data) don't necessarily share the same control characters, though, and generally won't have the same binary representation of an ASCII control character (so CHR(1) in a non-ASCII based database wouldn't necessarily return the same character that CHR(1) would in an ASCII based database).
    Justin

  • How to create a dyanamic query in PL/SQL from XML

    Hi Forum,
    I am having an XML file with tags. I am controlling my JSP page layout with these tags and it is working fine. But I need to send the Orange colour nodes to a pl/sql in the JSP page to construct the query as per the XML
    <?xml version="1.0"?>
    <Jobmanage>
    <Customer name="StGeorge">
    <Column>
    <Name>QM_NUMBER</Name>
    <Title>Job Number</Title>
    <Width>10</Width>
    <Font>Arial</Font>
    <Size>10</Size>
    <Align>center</Align>
    <Display>Yes</Display>
    <cloumn1> QM_NUMBER <column1>
    </Column>
    <Column>
    <Name>QM_JOB_STATUS</Name>
    <Title>Job Status</Title>
    <Width>10</Width>
    <Font>Arial</Font>
    <Size>105</Size>
    <Align>center</Align>
    <Display>Yes</Display>
    <column2>QM_JOB_STATUS</column2>
    </Column>
    <Column>
    <Name>QM_USER_STATUS</Name>
    <Title>User Status</Title>
    <Width>10</Width>
    <Font>Arial</Font>
    <Size>10</Size>
    <Align>center</Align>
    <Display>Yes</Display>
    <column3>QM_USER_STATUS</column3>
    </Column>
    </Customer>
    </Jobmanage>
    The select statement I am using n the JSP page is
    SELECT Q.QM_NUMBER, Q.QM_JOB_STATUS, Q.QM_USER_STATUS FROM QMI Q WHERE ((Q.QM_JOB_STATUS IN (5, 6, 7, 8, 9, 10)) OR (Q.QM_JOB_STATUS IN (12) AND Q.QM_CLOSE_DATE >= SYSDATE - INTERVAL '6' MONTH))
    Can you give me instructions how to create the above SQL statement dynamically as per the XML file. I want the select statement in a pl/sql
    BEGIN
    SELECT Q.QM_NUMBER, Q.QM_JOB_STATUS, Q.QM_USER_STATUS FROM QMI Q WHERE ((Q.QM_JOB_STATUS IN (5, 6, 7, 8, 9, 10)) OR (Q.QM_JOB_STATUS IN (12) AND Q.QM_CLOSE_DATE >= SYSDATE - INTERVAL '6' MONTH))
    END
    So, when ever the columns hirerachy changed in the XML file it should show theat effect in the PL/SQl. Thats hoe I am aiming to develop.
    Thankx for you time.
    Cheers,
    Krishna

    I want the select statement in a pl/sql BEGIN
    SELECT Q.QM_NUMBER, Q.QM_JOB_STATUS, Q.QM_USER_STATUS FROM QMI Q WHERE ((Q.QM_JOB_STATUS
    IN (5, 6, 7, 8, 9, 10)) OR (Q.QM_JOB_STATUS IN (12) AND Q.QM_CLOSE_DATE >=
    SYSDATE - INTERVAL '6' MONTH)) ENDThat doesn't make sense. Such a plsql block would not compile. What is your final goal you want to achieve with this?

  • How to create value objects from xml

    I am receiving xml back from my web service ( e4x ). I am
    trying to figure out how to create a value object without having to
    manually fetch each value in the value objects constructor. I am
    using introspecton in my Java web service to do this. Is there such
    a thing in Action Script?
    Anyone done this before that can share some code???? Any help
    would be very much appreciated.

    That's twice now I've heard that. lol.
    I am using Cairngorm and I suppose out of ignorance perhaps,
    I am using VO's. So my web service would return an Object Proxy and
    I have some code that could create objects dynamically from the
    results. The objects had to be simple of course and now they are
    becoming more complex thus the need to change to e4x instead of
    objects.
    So now I am trying to convert the xml result into the desired
    VO to be used throughout the rest of the application. I'm not sure
    how to use Cairngorm without the VO's they are tied to everything.
    Are you familiar with the architecture? Your thoughts?

  • Using Query to fetch data from xml file

    Hi guys ,
    Just want to know , how to fetch data from an XML file in adobe flex? i have a database generated xml file.

    you can use httpService.

  • Remove an element from XML present in CLOB column

    Hi,
    I need to remove element TEST2 and TEST3 from the below XML which is present in the CLOB column of a table. I need to do this using DBMS_XMLDOM package of Oracle as my existing code is using the same -
    <ROOT>
    <LEAF1>
    <TEST1>TEXT1</TEST1>
    <TEST2>TEXT2</TEST2>
    <TEST3>TEXT3</TEST3>
    </LEAF1>
    </ROOT>
    Hence the final o/p should be like
    <ROOT>
    <LEAF1>
    <TEST1>TEXT1</TEST1>
    </LEAF1>
    </ROOT>
    Please suggest how to achieve this.

    Something like this?
    Anton
    declare
      t_doc dbms_xmldom.DOMDocument;
      t_root dbms_xmldom.DOMNode;
      t_node dbms_xmldom.DOMNode;
      t_buf varchar2(1000);
    begin
      t_doc := dbms_xmldom.newDOMDocument( xmltype( '<ROOT>
    <LEAF1>
    <TEST1>TEXT1</TEST1>
    <TEST2>TEXT2</TEST2>
    <TEST3>TEXT3</TEST3>
    </LEAF1>
    </ROOT>' ) );
      t_root := dbms_xmldom.makeNode( t_doc );
      t_node := dbms_xmldom.removeChild( t_root, dbms_xslprocessor.selectSingleNode( t_root, '/ROOT/LEAF1/TEST2' ) );
      t_node := dbms_xmldom.removeChild( t_root, dbms_xslprocessor.selectSingleNode( t_root, '/ROOT/LEAF1/TEST3' ) );
      dbms_xmldom.writetoBuffer( t_root, t_buf );
      dbms_output.put_line( t_buf );
    end;

  • How to Edit the xml node value using flex from the front end UI

    Hi All,
    I am having a use case with flex 4.6
    1> To read the external xml file
    2> Display the tree structure in the front end UI
    3> Edit the node values of the xml file from the front end UI and save it back
    How to go about the above use case, any blogs or links on the above case will be help
    Thanks,
    Alok

    Check this is example:
    http://blog.flexexamples.com/2009/07/23/deleting-nodes-from-an-xml-object-in-flex/

  • Sql query, from xml to nested table

    Hello!
    I have DB table: my_table
    It has 2 fields: file_id and file_data (it's clob with xml)
    I need to write query that returns info from xml using nested table (Oracle v.9)
    The number of rows witch will return query must be equal to number of files (file_id)
    Structure of XML:
    <?xml version = "1.0" encoding = "utf-8"?>
    <head>
    <AAA v1="a" v2="b">
    <BBB p1="1" p2="2"/>
    <BBB p1="3" p2="4"/>
    </AAA>
    <AAA v1="c" v2="d">
    <BBB p1="5" p2="6"/>
    <BBB p1="7" p2="8"/>
    <BBB p1="9" p2="0"/>
    </AAA>
    </head>
    I have query, witch works! but not optimally! each CLOB scaned 3 times - I want to scan it once!
    SELECT an.file_id,
    CAST(MULTISET(SELECT extract(VALUE(val2),'//@v1').getStringVal() v1,
    extract(VALUE(val2),'//@v2').getStringVal() v2,
    CAST(MULTISET(SELECT extract(VALUE(val3),'//@p1').getStringVal() p1,
    extract(VALUE(val3),'//@p2').getStringVal() p2,
    FROM TABLE (XMLSEQUENCE(XMLTYPE(an.file_data).EXTRACT('/head/AAA/BBB[../@v1='||extract(VALUE(val2),'//@v1').getStringVal()||']'))) val3) AS T_VAL3) info
    FROM TABLE (XMLSEQUENCE(XMLTYPE(an.file_data).EXTRACT('/head/AAA'))) val2) AS T_VAL2) head
    FROM (SELECT olr.*
    FROM my_table olr,
    TABLE (XMLSEQUENCE(XMLTYPE(file_data)).EXTRACT('/head'))) val1) an
    PLEASE, help me to rewrite this query!

    I assume you're using nested objects like these to hold the result?
    create type t_val3_rec as object ( p1 number, p2 number );
    create type t_val3 as table of t_val3_rec;
    create type t_val2_rec as object ( v1 varchar2(30), v2 varchar2(30), c1 t_val3 );
    create type t_val2 as table of t_val2_rec;
    /then this query should work :
    SELECT t.file_id
         , CAST(
             MULTISET(
               SELECT extractvalue(value(x1), '/AAA/@v1')
                    , extractvalue(value(x1), '/AAA/@v2')
                    , CAST(
                        MULTISET(
                          SELECT extractvalue(value(x2), '/BBB/@p1')
                               , extractvalue(value(x2), '/BBB/@p2')
                          FROM TABLE(XMLSequence(extract(value(x1), '/AAA/BBB'))) x2
                        AS t_val3
               FROM TABLE(XMLSequence(extract(value(x), '/head/AAA'))) x1
             AS t_val2
    FROM my_table t
       , TABLE(XMLSequence(extract(xmltype(t.file_data), '/head'))) x
    ;

  • Need to retrieve all the node values of xml using DOM parser..pls help

    I want to fetch each node value in this xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <Main>
    <AAAAA>
    <ES>ESValue</ES>
    <EI>EIValue</EI>
    </AAAAA>
    <BBBBB>
    <SIP>
    <ST>STValue</ST>
    <TB>TBValue</TB>
    <PM>PMValue</PM>
    <VIP>
    <CARP>
    <AN1>AN1Value</AN1>
    <BN>BNValue</BN>
    </CARP>
    <DARP>
    <SA>
    <AN2>AN2Value</AN2>
    <CN>CNValue</CN>
    </SA>
    </DARP>
    </VIP>
    </SIP>
    </BBBBB>
    </Main>
    output should be the inner text values of diffrent nodes that contain some values..
    i.e
    output:
    ESValue
    EIValue
    STValue
    TBValue
    PMValue
    AN1Value
    BNValue
    AN2Value
    CNValue
    so that i can use thses node values and put it them in database...

    pls check the above xml file in proper redable order...I need to parse using DOM and fetch node values that are present...
    <?xml version="1.0" encoding="UTF-8"?>
    <Main>
        <AAAAA>
            <ES>ESValue</ES>
            <EI>EIValue</EI>
        </AAAAA>
        <BBBBB>
            <SIP>
                <ST>STValue</ST>
                <TB>TBValue</TB>
                <PM>PMValue</PM>
                <VIP>
                    <CARP>
                        <AN1>AN1Value</AN1>
                        <BN>BNValue</BN>
                    </CARP>
                    <DARP>
                        <SA>
                            <AN2>AN2Value</AN2>
                            <CN>CNValue</CN>
                        </SA>
                    </DARP>
                </VIP>
            </SIP>
        </BBBBB>
    </Main>

  • Multi-Valued Properties in XML Forms

    Hello,
    Can anyone tell me how to select multiple values for multi-valued properties in an XML Forms. It seems that the combo box only allows you to select one value.
    Thanks,
    Chris.

    Hi Chris,
    nice to hear, that you're implementing my way of solving this multi value issue. And much nicer to hear, that it seems to work for you, too!
    You can not write back your multi value properties from XML form. Thats for sure. You can think of:
    1. Synchronize the value of your text field property with the value of the multi value propery whenever you store the document. This could be done using the event "property set".
    <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5d0ab890-0201-0010-849d-98d70bd1d5f0">See: KM Events</a>
    2. Overwrite the content of your multi value property at runtime, depending on the value of the single value property which holds the csv. Do this by using a Repository Filter. <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/70ee3a57-0701-0010-3e9a-ddae7e4e0521">See: RepositoryFilter</a>
    3. Forget about the multi value property and make the text field property indexable. This should work, too.
    All three options should work!
    HTH,
    Carsten

Maybe you are looking for

  • Problem in Printing of mutiple form on single click

    Hi all I m wrking on AFS and i had created a page for printing multiple invoice print on single click. A range of invoice is given as input and get out in the form of print preivew or print wat v choose . I mean a print pop is open for multiple invoi

  • Update Taxes in PO without Tax code in Purchase Order

    Hi Experts, Taxes percentage are frequently change in Indian business and create new input tax codes for updating the same changes in PO. Please suggest without create new tax codes how can we maintained tax details in PO? Thanks in advance. Regards,

  • Little Problem with Pages

    Hi In the font colour pallet in Pages there are three different shades of orange that I have dragged and dropped as a "favorite" into the little blank boxes, just under the colour spectrum. How do I remove these favorite / preferred colours from thes

  • Handle rounding error

    hello, I understand that rounding errors exist and I need help determining the best way to handle them.  The particular situation I am dealing with relates to finding the equation of a line and comparing the calculated values to a data set.   The big

  • Appending to a zero length clob

    9.2.0.6 this works: var myClob clob begin :myClob := to_clob(' '); for rec in (select * from delme1) loop dbms_lob.append(:myClob ,to_clob(rec.ename || '\n')); end loop; end; but this does not var myClob clob begin :myClob := to_clob(''); for rec in