Query XML data for blanks

Hi 
I am try to see if there are any blanks in a node of a table that has xml data in one of the columns. The query I use is returning zero results. Any suggestions?
Select COUNT(*)from ENTITY
Where CONVERT(XML, Ent_root_xml, 0 ).value('(//UD_PQ_FLAG/node())[1]', 'VARCHAR(50)')= ' '

This is a little tricky. When you don't use /text(), looking for space is the right thing. But when you use /text() you should look for NULL:
DECLARE @x TABLE (id int NOT NULL, x xml NOT NULL)
INSERT @x (id, x)
   VALUES (1, '<ROOT><Node>This node is intentionally not left blank.</Node></ROOT>'),
          (2, '<ROOT><Node></Node></ROOT>')
SELECT id
FROM   @x
CROSS  APPLY x.nodes('/ROOT') AS T(x)
WHERE  T.x.value('(Node/text())[1]', 'varchar(23)') IS NULL
SELECT id
FROM   @x
CROSS  APPLY x.nodes('/ROOT') AS T(x)
WHERE  T.x.value('Node[1]', 'varchar(23)') = ' '
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Problem inserting and querying XML data with a recursive XML schema

    Hello,
    I'm facing a problem with querying XML data that is valid against a recursive XML Schema. I have got a table category that stores data as binary XML using Oracle 11g Rel 2 on Windows XP. The XML Schema is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>I registered this schema and created the category table. Then I inserted a new row using the code below:
    insert into category_a values
    (XMlElement("category",
          xmlattributes('categoryAAA' as "id"),
          xmlforest ('ma categ' as "name"),
          (xmlelement("description", (xmlelement("text", 'find doors blest now whiles favours carriage tailor spacious senses defect threat ope willow please exeunt truest assembly <keyword> staring travels <bold> balthasar parts attach </bold> enshelter two <emph> inconsiderate ways preventions </emph> preventions clasps better affections comes perish </keyword> lucretia permit street full meddle yond general nature whipp <emph> lowness </emph> grievous pedro')))    
    The row is successfully inserted as witnessed by the results of row counting. However, I cannot extract data from the table. First, I tried using SqlPlus* which hangs up and quits after a while. I then tried to use SQL Developer, but haven't got any result. Here follow some examples of queries and their results in SQL Developer:
    Query 1
    select * from category
    Result : the whole row is returned
    Query 2
    select xmlquery('$p/category/description' passing object_value as "p" returning content) from category
    Result: "SYS.XMLTYPE"
    now I tried to fully respect the nested structure of description element in order to extract the text portion of <bold> using this query
    Query 3
    select  xmlquery('$p/category/description/text/keyword/bold/text()' passing object_value as "p" returning content) from  category_a
    Result: null
    and also tried to extract the text portion of element <text> using this query
    Query 4
    select  xmlquery('$p/category/description/text/text()' passing object_value as "p" returning content) from  category_a
    Result: "SYS.XMLTYPE".
    On the other hand, I noticed, from the result of query 1, that the opening tags of elements keyword and bold are encoded as the less than operator "&lt;". This explains why query 3 returns NULL. However, query 4 should display the text content of <text>, which is not the case.
    My questions are about
    1. How to properly insert the XML data while preserving the tags (especially the opening tag).
    2. How to display the data (the text portion of the main Element or of the nested elements).
    The problem about question 1 is that it is quite unfeasible to write a unique insert statement because the structure of <description> is recursive. In other words, if the structure of <description> was not recursive, it would be possible to embed the elements using the xmlelement function during the insertion.
    In fact, I need to insert the content of <description> from a source table (called category_a) into a target table (+category_b+) automatically .
    I filled category_a using the Saxloader utility from an flat XML file that I have generated from a benchmark. The content of <description> is different from one row to another but it is always valid with regards to the XML Schema. The data is properly inserted as witnessed by the "select * from category_a" instruction (500 row inserted). Besides, the opening tags of the nested elements under <description> are preserved (no "&lt;"). Then I wrote a PL/SQL procedure in which a cursor extracts the category id and category name into varchar2 variables and description into an XMLtype variable from category_a. When I try to insert the values into a category_b, I get the follwing error:
    LSX-00213: only 0 occurrences of particle "text", minimum is 1which tells that the <text> element is absent (actually it is present in the source table).
    So, my third question is why are not the tags recognized during the insertion?
    Can anyone help please?

    Hello,
    indded, I was using an old version of Sqlplus* (8.0.60.0.0) because I had a previous installation (oracle 10g XE). Instead, I used the Sqlplus* shipped with the 11g2database (version 11.2.0.1.0). All the queries that I wrote work fine and display the data correctly.
    I also used the XMLSERIALIZE function and can now display the description content in SQL Developer.
    Thank you very much.
    To answer your question Marco, I registered the XML Schema using the following code
    declare
      doc varchar2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="bold_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="keyword_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
                   <xs:element name="plain_text" type="xs:string"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="emph_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="text_type" mixed="true">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="bold" type="bold_type"/>
                   <xs:element name="keyword" type="keyword_type"/>
                   <xs:element name="emph" type="emph_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="parlist_type">
              <xs:sequence>
                   <xs:element name="listitem" minOccurs="0" maxOccurs="unbounded" type="listitem_type"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="listitem_type">
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                   <xs:element name="parlist" type="parlist_type"/>
                   <xs:element name="text" type="text_type"/>
              </xs:choice>
         </xs:complexType>
         <xs:element name="category">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="name"/>
                        <xs:element name="description">
                                  <xs:complexType>
                                            <xs:choice>
                                                           <xs:element name="text" type="text_type"/>
                                                           <xs:element name="parlist" type="parlist_type"/>
                                            </xs:choice>
                                  </xs:complexType>
                        </xs:element>
                                                                </xs:sequence>
                                                                <xs:attribute name="id"/>
                                            </xs:complexType>
                        </xs:element>
    </xs:schema>';
    begin
      dbms_xmlschema.registerSchema('/xmldb/category_auction.xsd', doc,     LOCAL      => FALSE, 
            GENTYPES   => FALSE,  GENBEAN    => FALSE,   GENTABLES  => FALSE,
             FORCE      => FALSE,
             OPTIONS    => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
             OWNER      => USER);
    end;then, I created the Category table as follows:
    CREATE TABLE category_a of XMLType XMLTYPE store AS BINARY XML
        XMLSCHEMA "xmldb/category_auction.xsd" ELEMENT "category";Now, there still remains a problem of how to insert the "description" content which I serialized as a CLOB data into another table as XML. To this purpose, I wrote a view over the Category_a table as follows:
    CREATE OR REPLACE FORCE VIEW "AUCTION_XWH"."CATEGORY_V" ("CATEGORY_ID", "CNAME", "DESCRIPTION") AS
      select category_v."CATEGORY_ID",category_v."CNAME",
      XMLSerialize(content ( xmlquery('$p/category/description/*' passing object_value as "p" returning content)) as clob) as "DESCRIPTION"
      from  auction.category_a p, 
    xmltable ('$a/category' passing p.Object_Value as "a"
    columns  category_id varchar2(15) path '@id',
              cname varchar2(20) path 'name') category_v;Then, I wrote a procedure to insert data into the Category_xwh table (the source and target tables are slightly different: the common elements are just copied wereas new elements are created in the target table). The code of the procedure is the following:
    create or replace PROCEDURE I_CATEGORY AS
    v_cname VARCHAR2(30);
    v_description clob ;
    v_category_id VARCHAR2(15);
    cursor mycursor is select category_id, cname, description from category_v;
    BEGIN
    open mycursor;
      loop
      /*retrieving the columns*/
      fetch mycursor into v_category_id, v_cname, v_description ;
      exit when mycursor%notfound;
      insert into category_xwh values
      (XMlElement("category",
          xmlattributes(v_category_id as "category_id"),
          xmlelement("Hierarchies", xmlelement("ObjHierarchy", xmlelement ("H_Cat"),
                                                               xmlelement ("Rollsup",
                                                                                  (xmlelement("all_categories",
                                                                                   xmlattributes('allcategories' as "all_category_id")))
        xmlforest (
                  v_cname as "cat_name",
                  v_description as "description")    
    end loop;
      commit;
      close mycursor;
    END I_CATEGORY;When I execute the procedure, I get the following error:
    LSX-00201: contents of "description" should be elements onlyso, I just wonder if this is because v_description is considered as plain text and not as XML text, even if its content is XML. Do I need to use a special function to cast the CLOB as XML?
    Thanks for your help.
    Doulkifli

  • How to query XML data stored in a CLOB column

    I don't know XMLDB, so I have a dumb question about querying XML data which is saved as CLOB in a table.
    I have a table (OLAP_AW_PRC), with a CLOB column - AW_XML_TMPL_VAL
    This column contains this xml data - [click here|http://www.nasar.net/aw.xml]
    Now I want to query the data using the xml tags - like returning the name of AW. This is where I am having trouble, how to query the data from AW_XML_TMPL_VAL clob column.
    The following query generates error:
    ORA-31011: XML parsing failed.
    ORA-19202: Error occurred in XML processing
    LPX-00229: input source is empty
    SELECT
    extractValue(value(x), '/AW/LongName') as "AWNAME"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/Name') = 'OMCR4'
    - Nasar

    Mark,
    Thanks. This is exactly what I was looking for.
    After doing @Name in both places (SELECT and WHERE clause) it worked.
    Now I have one more question.
    There are multiple DIMENSION tags in my xml, and I want to see the NAME attribute values for all of those DIMENSIONs. The following query returns
    ORA-19025: EXTRACTVALUE returns value of only one node.
    Cause: Given XPath points to more than one node.
    Action: Rewrite the query so that exactly one node is returned.
    SELECT
    extractValue(value(x), '/AW/@Name') as "AW",
    extractValue(value(x), '/AW/Dimension/@Name') as "DIMENSIONS"
    from
    OLAP_AW_PRC,
    table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
    where
    extractValue(value(x) , '/AW/@Name') = 'OMCR4'

  • Query xml data from a CLOB datatye

    All,
    I read in an oracle white paper that is is possible to query XML data from CLOB datatype using oracle text index using operators HASPATH() and INPATH(). I am not able to find any example on how to do this. Can someone please post a simple example here.
    Thank You very much!

    SCOTT@10gXE> CREATE TABLE your_table (id NUMBER, xml_data CLOB)
      2  /
    Table created.
    SCOTT@10gXE> INSERT INTO your_table (id, xml_data)
      2  SELECT t.deptno,
      3           DBMS_XMLGEN.GETXML
      4             ('SELECT d.dname,
      5                   CURSOR (SELECT e.ename, e.job
      6                        FROM   emp e
      7                        WHERE  e.deptno = d.deptno) emp_data
      8            FROM   dept d
      9            WHERE  d.deptno = ' || t.deptno)
    10  FROM   dept t
    11  /
    5 rows created.
    SCOTT@10gXE> COMMIT
      2  /
    Commit complete.
    SCOTT@10gXE> begin
      2    ctx_ddl.create_section_group('xmlpathgroup', 'PATH_SECTION_GROUP');
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> CREATE INDEX myindex
      2  ON your_table(xml_data)
      3  INDEXTYPE IS ctxsys.context
      4  PARAMETERS ('datastore ctxsys.default_datastore
      5              filter ctxsys.null_filter
      6              section group xmlpathgroup'
      7            )
      8  /
    Index created.
    SCOTT@10gXE> SELECT * FROM your_table
      2  WHERE  CONTAINS (xml_data, 'PERSONNEL INPATH (//DNAME)') > 0
      3  /
            ID XML_DATA
            50 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DNAME>PERSONNEL</DNAME>
                 <EMP_DATA>
                 </EMP_DATA>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> SELECT * FROM your_table
      2  WHERE  CONTAINS (xml_data, 'HASPATH (//DNAME="PERSONNEL")') > 0
      3  /
            ID XML_DATA
            50 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DNAME>PERSONNEL</DNAME>
                 <EMP_DATA>
                 </EMP_DATA>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> SELECT * FROM your_table
      2  WHERE  CONTAINS (xml_data, 'CLARK INPATH (//ENAME)') > 0
      3  /
            ID XML_DATA
            10 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DNAME>ACCOUNTING</DNAME>
                 <EMP_DATA>
                  <EMP_DATA_ROW>
                   <ENAME>CLARK</ENAME>
                   <JOB>MANAGER</JOB>
                  </EMP_DATA_ROW>
                  <EMP_DATA_ROW>
                   <ENAME>KING</ENAME>
                   <JOB>PRESIDENT</JOB>
                  </EMP_DATA_ROW>
                  <EMP_DATA_ROW>
                   <ENAME>MILLER</ENAME>
                   <JOB>CLERK</JOB>
                  </EMP_DATA_ROW>
                 </EMP_DATA>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> SELECT * FROM your_table
      2  WHERE  CONTAINS (xml_data, 'HASPATH (//ENAME="CLARK")') > 0
      3  /
            ID XML_DATA
            10 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DNAME>ACCOUNTING</DNAME>
                 <EMP_DATA>
                  <EMP_DATA_ROW>
                   <ENAME>CLARK</ENAME>
                   <JOB>MANAGER</JOB>
                  </EMP_DATA_ROW>
                  <EMP_DATA_ROW>
                   <ENAME>KING</ENAME>
                   <JOB>PRESIDENT</JOB>
                  </EMP_DATA_ROW>
                  <EMP_DATA_ROW>
                   <ENAME>MILLER</ENAME>
                   <JOB>CLERK</JOB>
                  </EMP_DATA_ROW>
                 </EMP_DATA>
                </ROW>
               </ROWSET>
    SCOTT@10gXE>

  • Query picking data for the running request

    Hi Guyz,
    Am working on BW 3.5,
    We run a query on a Multicube on daily basis, the scenario here is when we ran a query during one of the infocube load which was not activated and not ready for reporting (Request for reporting available symbol is missing), even then the query picked data for the request which was still running.
    Cheers!
    Ravi
    Edited by: Ravi Srinivas on Aug 18, 2009 1:20 PM

    Good to know that your doubts are cleared...
    For more information browse through SDN and have a look at these notes:
    Note 411725 - Questions regarding transactional InfoCubes
    Note 1063466 - Transactional request is not set to qualok
    Hope it helps...
    Regards,
    Ashish

  • Receiving OCI/ORA-27163 when querying XML data in 11g.

    When querying a table with a column stored in XML format, we get this error for large XML values. This works in Oracle 10g but this error happens when the same data is queried in an 11.2.0.3 instance. I have had a support request open with Oracle for about a month and so far it has not made any progress. What we've seen are the following:
    1. The xml data itself is good.
    2. The good xml data when queried with a wholly 10g client/server environment, works.
    3. The same good xml data when inserted into a table in an 11g instance through a stored package run from the 11g instance (server to server) gets the 27163 error.
    4. The same xml data when queried in a 10g instance from an 11g client fails with the 27163 error.
    5. If we disable the 11g XML parser by setting an internal event (alter session set events='31156 trace name context forever, level 0x400';), then run the same code that was run in item 3 above, it does not get the 27163 error. However, the xml loaded to the 11g instance can then only be queried without getting the 27163 error if we use an older 10g client. An 11g client consistently gets the error.
    The server versions are 11.2.0.3 (upgraded from 10.2.0.4). The SQL*Net client versions that we have tested on are 11.2.0.2 and 11.2.0.3 (both produce the 27163 error).
    With considerable trial and error, we found that it is some combination of the file size and format that causes the error. Copied below is the smallest sample data of a failing XML that will produce this erro (about 8K). Remove any single character even in an a comment and the file parses successfully – but it’s not the file size alone as the original 800+KB file where we first dicovered this problem will process if the period in the attribute: @value=”${item.id}” is removed.
    We are at our wit's end, and with an 11g migration project looming, any ideas anyone can suggest would be very helpful.
    Thanks,
    Joe
    Here is a test case to play around with. Sorry I don't have a way to upload a zip file for this, but you can cut & paste from the post:
    1. CREATE TABLE my_xml_test
    (record_id NUMBER(4,0),
    xml SYS.XMLTYPE,
    comments VARCHAR2(200))
    ALTER TABLE my_xml_test
    ADD CONSTRAINT my_xml_test_pk PRIMARY KEY (record_id)
    USING INDEX
    2. mkdir SampleData
    3. cd into SampleData, copy the XML I will post in the first reply to this message into a new text document called xml_items_removed.xml.
    4. cd .. and create a file called 20120112_11g_bad_xml_issue.txt with this in it:
    1, .\SampleData\xml_items_removed.xml,"Fails: OriginalXML w/ all instances of <Item> removed (count 600) -- reduces file size to ca. 55KB but still fails (Saved by XMLSpy)"
    5. Next create your SQL*Loader control file (call it my_xml_test.ctl):
    LOAD DATA
    APPEND INTO TABLE my_xml_test
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    record_id,
    ext_fname FILLER CHAR(200),
    xml LOBFILE(ext_fname) TERMINATED BY EOF,
    comments
    6. sqlldr <username>/<password>@<database> control=my_xml_test.ctl data=20120112_11g_bad_xml_issue.txt log=20120112_11g_bad_xml_issue.log bad=20120112_11g_bad_xml_issue.bad
    7. Once the data is loaded, query my_xml_test table that you created in step 1. You should get the 27163 error:
    SELECT a.record_id,
    comments,
    a.XML,
    length(a.XML.GetClobVal()) clob_length
    FROM my_xml_test a

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2012 sp1 (http://www.altova.com) by Martin l (National Board of Medical Examiners) -->
    <IRData application="Item Review" version="1.3" itempool="2006001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <ViewerTypes>
              <Viewer id="its-viewer">
                   <Title>Item Text</Title>
                   <Description>Item Text</Description>
                   <BaseUrl>https://www.starttest.com/flex/4.3.0.0/InstitutionViewItem.aspx</BaseUrl>
                   <Parameters>
                        <Parameter name="pid" value="MSST"/>
                        <Parameter name="iid" value="01123"/>
                        <Parameter name="username" value="SomeUser"/>
                        <Parameter name="item" value="${item.id}"/>
                        <Parameter name="code" value="${CODE}"/>
                   </Parameters>
              </Viewer>
         </ViewerTypes>
         <Filters>
              <Filter id="drop-single-filter">
                   <AttributeSource>drop</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="onoff-single-filter">
                   <AttributeSource>onoff</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="reviewed-single-filter">
                   <AttributeSource>reviewed</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="build-multi-filter">
                   <AttributeSource>build</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="flag-multi-filter">
                   <AttributeSource>flag</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="u1dt-multi-filter">
                   <AttributeSource>U1DT</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="fb2-multi-filter">
                   <AttributeSource>FB2</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="fb1t-multi-filter">
                   <AttributeSource>FB1T</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="scorecat-multi-filter">
                   <AttributeSource>scorecat</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="images-multi-filter">
                   <AttributeSource>PIXN</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
              <Filter id="vignettes-multi-filter">
                   <AttributeSource>VIG1</AttributeSource>
                   <ControlType>select-1-drop-down-plus-all</ControlType>
              </Filter>
         </Filters>
         <DataPanels>
              <Control displayed="true">
                   <Filters>
                        <Filter>
                             <Description>Drop</Description>
                             <FilterSource>drop-single-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Version</Description>
                             <FilterSource>build-multi-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>On/Off Test</Description>
                             <FilterSource>onoff-single-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Review status</Description>
                             <FilterSource>reviewed-single-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Flag</Description>
                             <FilterSource>flag-multi-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Discipline</Description>
                             <FilterSource>fb1t-multi-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Organ System</Description>
                             <FilterSource>u1dt-multi-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Step 1 outline</Description>
                             <FilterSource>fb2-multi-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Images</Description>
                             <FilterSource>images-multi-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Vignettes</Description>
                             <FilterSource>vignettes-multi-filter</FilterSource>
                        </Filter>
                        <Filter>
                             <Description>Score categories</Description>
                             <FilterSource>scorecat-multi-filter</FilterSource>
                        </Filter>
                   </Filters>
              </Control>
              <ItemList displayed="true">
                   <Attributes>
                        <Attribute displayed="true">
                             <Description>Item</Description>
                             <AttributeSource>itemref</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>On test</Description>
                             <AttributeSource>onoff</AttributeSource>
                             <ControlType>checkbox-select</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Drop</Description>
                             <AttributeSource>drop</AttributeSource>
                             <ControlType>checkbox-select</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Reviewed</Description>
                             <AttributeSource>reviewed</AttributeSource>
                             <ControlType>check-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Flag</Description>
                             <AttributeSource>flag</AttributeSource>
                             <ControlType>select-1-drop-down</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Description</Description>
                             <AttributeSource>DESCR</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Discipline</Description>
                             <AttributeSource>FB1T</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Organ System</Description>
                             <AttributeSource>U1DT</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Step 1 outline</Description>
                             <AttributeSource>FB2</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <!-- Attribute displayed="false">                         <Description>Organ System plus</Description>                         <AttributeSource>ORGA</AttributeSource>                         <ControlType>text-display</ControlType>                    </Attribute -->
                        <Attribute displayed="true">
                             <Description>Images</Description>
                             <AttributeSource>PIXN</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Vignettes</Description>
                             <AttributeSource>VIG1</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Diff</Description>
                             <AttributeSource>pvalue</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Discr</Description>
                             <AttributeSource>rbvalue</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Answer Key</Description>
                             <AttributeSource>key</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                        <Attribute displayed="true">
                             <Description>Notes</Description>
                             <AttributeSource>notes</AttributeSource>
                             <ControlType>text-display</ControlType>
                        </Attribute>
                   </Attributes>
              </ItemList>
              <CurrentItemInfo>
                   <ItemText displayed="true"/>
                   <ItemData>
                        <Attribute>
                             <DataSource>scorecat</DataSource>
                             <ControlType>select-each-value</ControlType>
                        </Attribute>
                   </ItemData>
              </CurrentItemInfo>
         </DataPanels>
    </IRData>
    <?BASELINE FB2-A.02.01 on:4 off:3?>
    <?BASELINE FB2-A.02.02 on:4 off:4?>
    <?BASELINE FB2-A.03.01 on:3 off:1?>
    <?BASELINE FB2-A.03.02 on:0 off:1?>
    <?BASELINE FB2-A.03.04 on:3 off:2?>
    <?BASELINE FB2-A.03.05 on:1 off:0?>
    <?BASELINE FB2-A.03.07 on:4 off:2?>
    <?BASELINE FB2-A.04.01 on:2 off:5?>
    <?BASELINE FB2-A.04.02 on:5 off:3?>
    <?BASELINE FB2-A.04.03 on:3 off:1?>
    <?BASELINE FB2-A.04.04 on:1 off:1?>
    <?BASELINE FB2-A.05.01 on:12 off:14?>
    <?BASELINE FB2-A.05.02 on:9 off:1?>
    <?BASELINE FB2-A.05.03 on:0 off:6?>
    <?BASELINE FB2-A.06.01 on:7 off:9?>
    <?BASELINE FB2-A.06.02 on:2 off:6?>
    <?BASELINE FB2-A.06.03 on:10 off:5?>
    <?BASELINE FB2-A.06.04 on:1 off:1?>
    <?BASELINE FB2-A.07 on:23 off:20?>

  • Filter XML Data for ListBox

     This is the continuation of "Filter ListBox w/ XML Data using a TextBox"
    Andy, I read your paper last night. You are so high that I can only understand some of it right now, but you do bring up a performance issue, which needs to be considered for this thread.
    Is myListBox.Items a view or the items that have already loaded into the myListBox? I am confused. If myListBox.Items are the items that are currently in the myListBox, then there will be an performance issue if there are a huge amount of items in the myListBox.
    Am I right?
    Then, the process supposed to be:
    1, add XML source to Blend
    2, filter the source
    3, put in the listbox
    Then the code will be much complicated than the 1st one. right?
    private void filterBtn_Click(object sender, RoutedEventArgs e)
          myListBox.Items.Filter = target => ((XmlElement)target)["ID"].InnerText.Contains(myTextBox.Text);

    There's a pattern that almost every wpf dveloper uses and it's called mvvm.
    Google it, there'll be a shed load of articles.
    It's a passive view pattern in that the view has minimal logic in it.
    The view is your window ( or usercontrol).
    You can add a listboxitem to the listbox.items collection but i would only do  that if it's a very simple static collection.
    You can bind a collection to itemssource and the listbox will create a listboxitem for each things it gets from that collection.
    It creates them using a datatemplate.
    When you do that binding apparently directly to a collection a collectionvie is automagically created between control and collection.
    You can explicitly create one of those collectionview things yourself and this is agreat way to filter and sort.
    You can also use one of those collectionviews to navigate the collection setting the current item in the viewmodel.
    That can be synced in the view so you select an item from the viewmodel.
    I think I probably drifted off topic there somewhat.
    Mvvm is probably different from stuff you've done before.
    It's easier to do a bunch of things using mvvm plus it's what any prospective employer will want.
    Along with tdd/bdd it's industry standard.
    Big tip: learn it.
    You want to avoid showing a user a huge load of data. Not so much for performance reasons but because users can only cope with so much data at a time.
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

  • Problems handling xml data for tree control.

    Hi,
    I have tried using tree control for displaying my xml data
    but I had a problem that i did not have labels in my xml data. A
    sample xml data is attached. So it displays the whole data at each
    level in the tree. The root label will be the entire the xml data
    and then one level down the remaining xml data and so on...
    How do i solve this issue i,e get the tags names itself as
    labels..
    Thanks in advance....

    An update after some efforts..
    Could get the folders perfectly i.e until the level of
    CPUTime perfectly but could not get the leaf: 32 since i used the
    following to set the label.
    I would like to know if there is a way to find out if a node
    is a leaf or folder and according set the label

  • Filter XML Data for Text Fields.

    Hi,
    I'm trying to display a single record out of an XML database
    into dynamic fields in my MovieClip. I need to be able return a
    single record based on the current time. Attached is a sample of my
    XML data.
    I was wondering if this could be acheived with a DataSet
    filterFunction? If it is possible, what code would I need to
    include?
    Finally, do I need to pass my full DataSet to an array or do
    I need to filter first & then pass to an array?
    Thankyou.
    Elton Bernardson.

    There's a pattern that almost every wpf dveloper uses and it's called mvvm.
    Google it, there'll be a shed load of articles.
    It's a passive view pattern in that the view has minimal logic in it.
    The view is your window ( or usercontrol).
    You can add a listboxitem to the listbox.items collection but i would only do  that if it's a very simple static collection.
    You can bind a collection to itemssource and the listbox will create a listboxitem for each things it gets from that collection.
    It creates them using a datatemplate.
    When you do that binding apparently directly to a collection a collectionvie is automagically created between control and collection.
    You can explicitly create one of those collectionview things yourself and this is agreat way to filter and sort.
    You can also use one of those collectionviews to navigate the collection setting the current item in the viewmodel.
    That can be synced in the view so you select an item from the viewmodel.
    I think I probably drifted off topic there somewhat.
    Mvvm is probably different from stuff you've done before.
    It's easier to do a bunch of things using mvvm plus it's what any prospective employer will want.
    Along with tdd/bdd it's industry standard.
    Big tip: learn it.
    You want to avoid showing a user a huge load of data. Not so much for performance reasons but because users can only cope with so much data at a time.
    Hope that helps.
    Recent Technet articles: Property List Editing;
    Dynamic XAML

  • External XML data for plot chart

    Hi,
    Can you provide the XML equivalent & the corresponding changes to be done in the below plot chart code :
    <?xml version="1.0"?>
    <!-- charts/BasicPlot.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script><![CDATA[
         import mx.collections.ArrayCollection;
         [Bindable]
         public var expenses:ArrayCollection = new ArrayCollection([
            {Month:"January", Profit:2000, Expenses:1500, Amount:450},
            {Month:"February", Profit:1000, Expenses:200, Amount:600},
            {Month:"March", Profit:1500, Expenses:500, Amount:300},
            {Month:"April", Profit:500, Expenses:300, Amount:500},
            {Month:"May", Profit:1000, Expenses:450, Amount:250},
            {Month:"June", Profit:2000, Expenses:500, Amount:700}
      ]]></mx:Script>
      <mx:Panel title="Plot Chart">
         <mx:PlotChart id="myChart" dataProvider="{expenses}"
         showDataTips="true">
            <mx:series>
               <mx:PlotSeries
                    xField="Expenses"
                    yField="Profit"
                    displayName="Plot 1"
               />
               <mx:PlotSeries
                    xField="Amount"
                    yField="Expenses"
                    displayName="Plot 2"
               />
               <mx:PlotSeries
                    xField="Profit"
                    yField="Amount"
                    displayName="Plot 3"
               />
            </mx:series>
         </mx:PlotChart>
         <mx:Legend dataProvider="{myChart}"/>
      </mx:Panel>
    </mx:Application>

    This does what you want.
    If this post answers your question or helps, please mark it as such.
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      creationComplete="init();">
      <mx:Script>
        <![CDATA[
          import mx.collections.XMLListCollection;
          [Bindable] public var expenses:XMLListCollection;
          private function init():void{
            expenses = new XMLListCollection(XMLList(xml..dataItem));
          private var xml:XML =
            <data>
              <dataItem>
                <Month>January</Month>
                <Profit>2000</Profit>
                <Expenses>1500</Expenses>
                <Amount>450</Amount>
              </dataItem>
              <dataItem>
                <Month>February</Month>
                <Profit>1000</Profit>
                <Expenses>200</Expenses>
                <Amount>600</Amount>
              </dataItem>
              <dataItem>
                <Month>March</Month>
                <Profit>1500</Profit>
                <Expenses>500</Expenses>
                <Amount>300</Amount>
              </dataItem>
              <dataItem>
                <Month>April</Month>
                <Profit>500</Profit>
                <Expenses>300</Expenses>
                <Amount>500</Amount>
              </dataItem>
              <dataItem>
                <Month>May</Month>
                <Profit>1000</Profit>
                <Expenses>450</Expenses>
                <Amount>250</Amount>
              </dataItem>
              <dataItem>
                <Month>June</Month>
                <Profit>2000</Profit>
                <Expenses>500</Expenses>
                <Amount>700</Amount>
              </dataItem>
            </data>;
      ]]></mx:Script>
      <mx:Panel title="Plot Chart">
         <mx:PlotChart id="myChart" dataProvider="{expenses}"
         showDataTips="true">
            <mx:series>
               <mx:PlotSeries
                    xField="Expenses"
                    yField="Profit"
                    displayName="Plot 1"
               />
               <mx:PlotSeries
                    xField="Amount"
                    yField="Expenses"
                    displayName="Plot 2"
               />
               <mx:PlotSeries
                    xField="Profit"
                    yField="Amount"
                    displayName="Plot 3"
               />
            </mx:series>
         </mx:PlotChart>
         <mx:Legend dataProvider="{myChart}"/>
      </mx:Panel>
    </mx:Application>

  • How do you query activity data for accounts?

    I need to extract account activity data. When I try to use the Activity WSDL it doesn't seem to provide any account information even though I do see fields like AccountId, AccountName. They are blank. Also it looks like there is way to do a activity query using the Account WSDL. Does anyone have an example of this?
    We are using Release 18 with V2 WSDL.
    Thank you,
    Dan
    Edited by: dansshin on Oct 14, 2010 2:33 PM

    I'm not sure what you mean by XML string but I'm trying to extract to CSV file using this code. It provides activity data but looks like account information fields are blank.
    Thank you,
    Dan
    private static void ExtractGrowerAccountActivity(String sessionID, String csvFileName)
    try
    // Download the opportunity wsdl from the Admin section of the CRM application
    // Add web reference to the wsdl
    // Create the instance of the account entity
    Activity myAcctAct = new Activity();
    myAcctAct.Url = ConfigurationManager.AppSettings["OnDemandURL"] + "/Services/Integration;jsessionid=" + sessionID;
    // Set the query
    // To find the record with account type as grower
    Activity_WS.queryType myAcctName = new Activity_WS.queryType();
    myAcctName.Value = "";
    // Create query instance and set the appropriate parameters
    Activity_WS.ActivityQuery myAcctActQuery = new Activity_WS.ActivityQuery();
    myAcctActQuery.AccountId = new Activity_WS.queryType();
    myAcctActQuery.AccountName = myAcctName;
    myAcctActQuery.AccountExternalSystemId = new Activity_WS.queryType();
    myAcctActQuery.Id = new Activity_WS.queryType();
    myAcctActQuery.Activity = new Activity_WS.queryType();
    myAcctActQuery.CreatedByFullName = new Activity_WS.queryType();
    myAcctActQuery.CreatedDate = new Activity_WS.queryType();
    myAcctActQuery.DueDate = new Activity_WS.queryType();
    myAcctActQuery.Completed = new Activity_WS.queryType();
    myAcctActQuery.CompletedDatetime = new Activity_WS.queryType();
    myAcctActQuery.Subject = new Activity_WS.queryType();
    myAcctActQuery.Type = new Activity_WS.queryType();
    // Set ListOfAccountQuery
    Activity_WS.ListOfActivityQuery lstOfAcctActQuery = new Activity_WS.ListOfActivityQuery();
    lstOfAcctActQuery.Activity = myAcctActQuery;
    // Number of records to fetch
    lstOfAcctActQuery.pagesize = "100";
    // set ActivityQueryPage_Input
    ActivityQueryPage_Input myActInput = new ActivityQueryPage_Input();
    myActInput.ListOfActivity = lstOfAcctActQuery;
    // Get the output
    ActivityQueryPage_Output myOutput = myAcctAct.ActivityQueryPage(myActInput);
    // Get ListOfAccountData
    Activity_WS.ListOfActivityData myAcctActData = myOutput.ListOfActivity;
    Activity_WS.ActivityData[] acctActData = myAcctActData.Activity;
    // Write to output file
    if (acctActData.Length > 0)
    using (var sw = new StreamWriter(csvFileName))
    // Write header
    sw.WriteLine("AccountID, AccountName, AccountType, ExternalID, ActivityID, ActivityType, CreatedBy, CreatedDate, DueDate, IsCompleted, CompletedDate, Subject, Type");
    for (int i = 0; i < acctActData.Length; i++)
    // Write detail
    sw.WriteLine(string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}",
    acctActData.AccountId,
    acctActData[i].AccountName,
    "Account Type",
    acctActData[i].AccountExternalSystemId,
    acctActData[i].Id,
    acctActData[i].Activity,
    acctActData[i].CreatedByFullName,
    acctActData[i].CreatedDate,
    acctActData[i].DueDate,
    acctActData[i].Completed == true ? "Y" : "N",
    acctActData[i].CompletedDatetime,
    acctActData[i].Subject,
    acctActData[i].Type));
    // Write to log
    log.Message = string.Format("INFO: {0} Grower account activity record(s) extracted.", acctActData.Length);
    log.Categories.Add(Category.General);
    log.Priority = Priority.Normal;
    writer.Write(log);
    catch (Exception ex)
    log.Message = string.Format("ERROR: " + ex.ToString());
    log.Categories.Add(Category.Error);
    log.Priority = Priority.High;
    writer.Write(log);

  • Report Query - XML data source empty

    Hello!
    I built a report query, using the wizard, under Shared Components and when I test the query using bind variables I get the correct data, but as I click Apply Changes and get to the screen where it gives me the option to Download the data source for the report layout, the file is empty. I've repeated the steps multiple times, each time getting correct data when testing the query, yet nothing in my xml file.
    Any ideas on why this is happening?
    Thank you.

    Hello! Thank you for responding!
    I actually am having problems on the "Report Queries" section under "Shared Components"...my query doesn't return any data when I try to download/open the xml file. Once I'm able to get this fixed, I'll be able to open my report on the page that has the branch.

  • Querying XML data in  Object Relational tables

    Hi,
    Can someone help me?
    I have registered the purchaseorder.xsd in my database schema.
    [ http://www.oracle.com/technology/oramag/oracle/03-jul/o43xml.html ]
    declare
    l_bfile bfile;
    begin
    l_bfile := bfilename(
    'XMLSAMP', 'purchaseOrder.xsd');
    dbms_lob.open(l_bfile);
    dbms_xmlschema.registerschema('http://localhost:8080/purchaseOrder.xsd', l_bfile);
    dbms_lob.close(l_bfile);
    end;
    This has created a table "PURCHASEORDER"
    SYS_NC_ROWINFO$ SYS.XMLTYPE
    It has also created object types.
    select object_name from user_objects where object_type = 'TYPE' and object_name like 'XDBPO%'
    XDBPO_ACTIONS_TYPE
    XDBPO_ACTION_COLLECTION
    XDBPO_ACTION_TYPE
    XDBPO_LINEITEMS_TYPE
    XDBPO_LINEITEM_TYPE
    XDBPO_PART_TYPE
    XDBPO_REJECTION_TYPE
    XDBPO_SHIPINSTRUCTIONS_TYPE
    XDBPO_TYPE
    I have also inserted an xml into that table.
    INSERT INTO "PURCHASEORDER"
    VALUES
    xmltype
    getFileContent('ADAMS-20011127121040988PST.xml','XMLSAMP')
    Now how do I retrieve the data from this table and the other object types?
    Is extractvalue the only method? I have gone thru examples in the net but everything uses the element names in xml document and not the object type names.
    For example to retreive the lineitem details, this query can be used
    SELECT extractValue(value(d),'/Description')
    FROM "PURCHASEORDER" p,
    table (xmlsequence(extract(p.SYS_NC_ROWINFO$,'/PurchaseOrder/LineItems/LineItem/Description'))) d
    But I want to retreive it from "XDBPO_LINEITEM_TYPE".
    Is this possible?
    Can someone help me please?
    Thanks in advance.
    Jay

    #1. If you had taken the time to read some of the other posts in the forum all of the answers you needed were all there..
    #2. As PM's we are not expected to spend a lot of time dealing with the forums. In general we are expected only to step in and answer the questions that are not easily answered by carefully reading existing posts or deal with cases were the wrong answer is supplied.
    #3. I'm technically on vacation, and posted to that effect last week, so pushing for an answer is not at all appreciated...
    #4. The problem is extremely simple, at least as stated in your simple example.
    Given the schema.. Note It's been annotated
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
         <xs:element name="Bill">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="InvCtlN"/>
                        <xs:element ref="MedBU"/>
                        <xs:element ref="Lineitem" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvCtlN">
              <xs:simpleType>
                   <xs:restriction base="xs:byte">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="LineCode">
              <xs:simpleType>
                   <xs:restriction base="xs:int">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Lineitem">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Type"/>
                        <xs:element ref="LineCode"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="MedBU">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="SampleFile" xdb:defaultTable="SAMPLE_FILE_TABLE">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Bill" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="Type">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
    </xs:schema>and the following instance
    <SampleFile xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="testcase.xsd">
         <Bill>
              <InvCtlN>1</InvCtlN>
              <MedBU>ABC</MedBU>
              <Lineitem>
                   <Type>P1</Type>
                   <LineCode>99214</LineCode>
              </Lineitem>
         </Bill>
         <Bill>
              <InvCtlN>2</InvCtlN>
              <MedBU>DEF</MedBU>
              <Lineitem>
                   <Type>P2</Type>
                   <LineCode>99215</LineCode>
              </Lineitem>
              <Lineitem>
                   <Type>P3</Type>
                   <LineCode>99216</LineCode>
              </Lineitem>
         </Bill>
         <Bill>
              <InvCtlN>3</InvCtlN>
              <MedBU>HJK</MedBU>
              <Lineitem>
                   <Type>P4</Type>
                   <LineCode>99217</LineCode>
              </Lineitem>
         </Bill>
    </SampleFile>The following appears to be what you are looking for
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:53 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool registerSchema_&4..log
    SQL> set trimspool on
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> declare
      2    result boolean;
      3  begin
      4    result := dbms_xdb.createResource('/home/&1/xsd/&4',
      5                                      bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
      6  end;
      7  /
    old   4:   result := dbms_xdb.createResource('/home/&1/xsd/&4',
    new   4:   result := dbms_xdb.createResource('/home/OTNTEST/xsd/testcase.xsd',
    old   5:                                    bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
    new   5:                                    bfilename(USER,'testcase.xsd'),nls_charset_id('AL32UTF8'));
    PL/SQL procedure successfully completed.
    SQL> commit
      2  /
    Commit complete.
    SQL> alter session set events='31098 trace name context forever'
      2  /
    Session altered.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      schemaURL => '&3',
      5      schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
      6      local     => TRUE,
      7      genTypes  => TRUE,
      8      genBean   => FALSE,
      9      genTables => &5
    10    );
    11  end;
    12  /
    old   4:     schemaURL => '&3',
    new   4:     schemaURL => 'testcase.xsd',
    old   5:     schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
    new   5:     schemaDoc => xdbURIType('/home/OTNTEST/xsd/testcase.xsd').getClob(),
    old   9:     genTables => &5
    new   9:     genTables => TRUE
    PL/SQL procedure successfully completed.
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:55 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool insertFile_&3..log
    SQL> set trimspool on
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> set long 10000
    SQL> --
    SQL> insert into &4 values (xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
      2  /
    old   1: insert into &4 values (xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
    new   1: insert into SAMPLE_FILE_TABLE values (xmltype(bfilename(USER,'testcase.xml'),nls_charset_id('AL32UTF8')
    1 row created.
    Elapsed: 00:00:00.06
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.00
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:55 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase.log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> --
    SQL> -- Testcase code here
    SQL> --
    SQL> set trimspool on
    SQL> set autotrace on explain
    SQL> set timing on
    SQL> set pages 10 lines 160 long 100000
    SQL> --
    SQL> column INVCTLN format  9999
    SQL> column MEDBU   format  A10
    SQL> column TYPE    format  A10
    SQL> column LINECODE format 999999999
    SQL> create or replace view MASTER_TABLE_VIEW
      2  (
      3     INVCTLN,
      4     MEDBU
      5  )
      6  as
      7  select extractValue(value(bill),'/Bill/InvCtlN'),
      8         extractValue(value(bill),'/Bill/MedBU')
      9    from SAMPLE_FILE_TABLE t,
    10         table(xmlsequence(extract(value(t),'/SampleFile/Bill'))) Bill
    11  /
    View created.
    Elapsed: 00:00:00.04
    SQL> create or replace view DETAIL_TABLE_VIEW
      2  (
      3     INVCTLN,
      4     TYPE,
      5     LINECODE
      6  )
      7  as
      8  select extractValue(value(bill),'/Bill/InvCtlN'),
      9         extractValue(value(LineItem),'/Lineitem/Type'),
    10         extractValue(value(LineItem),'/Lineitem/LineCode')
    11    from SAMPLE_FILE_TABLE t,
    12         table(xmlsequence(extract(value(t),'/SampleFile/Bill'))) Bill,
    13         table(xmlsequence(extract(value(bill),'/Bill/Lineitem'))) LineItem
    14  /
    View created.
    Elapsed: 00:00:00.05
    SQL> set autotrace on explain
    SQL> --
    SQL> select * from MASTER_TABLE_VIEW
      2  /
    INVCTLN MEDBU
          1 ABC
          2 DEF
          3 HJK
    Elapsed: 00:00:00.05
    Execution Plan
    Plan hash value: 2362844891
    | Id  | Operation          | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |                    |     3 |  6165 |   805   (1)| 00:00:10 |
    |   1 |  NESTED LOOPS      |                    |     3 |  6165 |   805   (1)| 00:00:10 |
    |*  2 |   TABLE ACCESS FULL| SAMPLE_FILE_TABLE  |     1 |    30 |     3   (0)| 00:00:01 |
    |*  3 |   INDEX RANGE SCAN | SYS_IOT_TOP_159053 |     3 |  6075 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
                  xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
                  http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><rea
                  d-properties/><read-contents/></privilege>'))=1)
       3 - access("NESTED_TABLE_ID"="SAMPLE_FILE_TABLE"."SYS_NC0000800009$")
    Note
       - dynamic sampling used for this statement
    SQL> select * from DETAIL_TABLE_VIEW
      2  /
    INVCTLN TYPE         LINECODE
          1 P1              99214
          3 P4              99217
          2 P2              99215
          2 P3              99216
    Elapsed: 00:00:00.07
    Execution Plan
    Plan hash value: 971642473
    | Id  | Operation               | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |                    |     4 |  8352 |   813   (0)| 00:00:10 |
    |   1 |  NESTED LOOPS           |                    |     4 |  8352 |   813   (0)| 00:00:10 |
    |   2 |   MERGE JOIN CARTESIAN  |                    |     4 |  8220 |   805   (0)| 00:00:10 |
    |*  3 |    TABLE ACCESS FULL    | SAMPLE_FILE_TABLE  |     1 |    30 |     3   (0)| 00:00:01 |
    |   4 |    BUFFER SORT          |                    |     4 |  8100 |   802   (0)| 00:00:10 |
    |   5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_159055 |     4 |  8100 |   802   (0)| 00:00:10 |
    |*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_159053 |     1 |    33 |     2   (0)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN     | SYS_C0022871       |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
                  xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
                  http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-pro
                  perties/><read-contents/></privilege>'))=1)
       6 - access("NESTED_TABLE_ID"="SYS_NTh/v83GzKQ1evte63P5QRog=="."SYS_NC0000700008$")
           filter("NESTED_TABLE_ID"="SAMPLE_FILE_TABLE"."SYS_NC0000800009$")
       7 - access("NESTED_TABLE_ID"="SYS_NTh/v83GzKQ1evte63P5QRog=="."SYS_NC0000700008$")
    Note
       - dynamic sampling used for this statement
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    C:\xdb\otn\362337>

  • Custom Map in flash using XML data for dynamic map and point of intrest loading...

    Been some time since I have used Flash for anything...
    I'm working on a little project to dynamically build a map
    and set points of interest on the map. At this time I have the
    (mySQL) data being queried and formatted with PHP and pushing the
    data to Flash as XML.
    In starting the project I'm a bit lost... I mean I have my
    data and a good XML format but as it is I'm lost on parsing the
    data in Flash and assigning its values to movie clips or other...
    I've looked at the Loader Component and the XML Connector
    Component and find I can get that to work at all...
    My second though was to create a single movie clip on stage
    and give it an instance name of "Background" and have it load the
    URL of an image given in the attached XML doc... Node "a_zone" and
    the value given to attribute "image"... But this brings me back to
    square one of not quite understanding Flash and parsing XML... With
    this second idea I would use AS to create a movie clip, set it's X
    & Y cords and load an image to it based on the XML attributes
    listed in the "Gatherable" node (one for each node).
    Any suggestions, examples or related info is welcome...
    Thanks in advance!

    Okay, that really wasn't what I was looking for... But I did
    go back and RTM :-)
    Here's what I have... 1st frame:
    2nd Layer: movieclip with the instance name "currentPicture"
    The image loads into "currentPicture" from the URL given in
    the XML "a_zone" node attribute "image" just fine....
    But I'm not able to grab the attributes of each "Gatherable"
    node it seems... am I missing something or just not pointing to the
    right node?
    I keep getting:
    undefined
    undefined
    undefined
    Error opening URL
    "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"
    Error opening URL
    "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"
    Error opening URL
    "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"

  • Optimizing performance when querying XML data

    I have a table in my database containing information about persons. The table has a xmltype column with a lot of data about that person.
    One of the things in there is a telephone number. What I now need to figure out is whether there are any duplicate phone numbers in there.
    The xml basically looks like this (simplefied example):
    <DATAGROUP>
        <PERSON>
            <BUSINESS_ID>123</BUSINESS_ID>
            <INITIALS>M.</INITIALS>
            <NAME>Testperson</NAME>
            <BIRTHDATE>1977-12-12T00:00:00</BIRTHDATE>
            <GENDER>F</GENDER>
            <TELEPHONE>
                <COUNTRYCODE>34</COUNTRYCODE>
                <AREACODE>06</AREACODE>
                <LOCALCODE>4318527235</LOCALCODE>
            </TELEPHONE>
        </PERSON>
    </DATAGROUP>
    As a result I would need the pk_id of the table with the xmltype column in it and a id that's unique for the person (the business_id that's also somewhere in the XML)
    I've conducted this query which will give me all telephone numbers and the number of times they occur.
      SELECT   OD.pk_ID,
               tel.business_id  ,
           COUNT ( * ) OVER (PARTITION BY tel.COUNTRYCODE, tel.AREACODE, tel.LOCALCODE) totalcount
           FROM   xml_data od,
           XMLTABLE ('/DATAGROUP/PERSON' PASSING OD.DATAGROUP
                     COLUMNS "COUNTRYCODE" NUMBER PATH '/PERSON/TELEPHONE/COUNTRYCODE',
                             "AREACODE" NUMBER PATH '/PERSON/TELEPHONE/AREACODE',
                             "LOCALCODE" NUMBER PATH '/PERSON/TELEPHONE/LOCALCODE',
                             "BUSINESS_ID"  NUMBER PATH '/PERSON/BUSINESS_ID'
                 ) tel
           WHERE  tel.LOCALCODE is not null --ignore persons without a tel nr
    Since I am only interested in the telephone number that occur more than once, I used the above query as a subquery:
    WITH q as (
      SELECT   OD.pk_ID,
               tel.business_id  ,
           COUNT ( * ) OVER (PARTITION BY tel.COUNTRYCODE, tel.AREACODE, tel.LOCALCODE) totalcount
           FROM   xml_data od,
           XMLTABLE ('/DATAGROUP/PERSON' PASSING OD.DATAGROUP
                     COLUMNS "COUNTRYCODE" NUMBER PATH '/PERSON/TELEPHONE/COUNTRYCODE',
                             "AREACODE" NUMBER PATH '/PERSON/TELEPHONE/AREACODE',
                             "LOCALCODE" NUMBER PATH '/PERSON/TELEPHONE/LOCALCODE',
                             "BUSINESS_ID"  NUMBER PATH '/PERSON/BUSINESS_ID'
                 ) tel
           WHERE  tel.LOCALCODE is not null) --ignore persons without a tel nr
    SELECT   OD.pk_ID,  tel.business_id
      FROM   q
    WHERE   totalcount > 1
    Now this is working and is giving me the right results, but the performance is dreadful with larger sets of data and will even go into errors like "LPX-00651 VM Stack overflow.".
    What I see is when I do a explain plan for the query is that there are things happening like "COLLECTION ITERATOR PICKLER FETCH PROCEDURE SYS.XQSEQUENCEFROMXMLTYPE" which seems to be something like a equivalent of a full table scan if I google on it.
    Any ideas how I can speed up this query? are there maybe smarter ways to do this?
    One thing to note is that the XMLTYPE data is not indexed in any way. Is there a possibility to do this? and how? I read about it in the oracle docs, but they where not very clear to me.     

    The "COLLECTION ITERATOR PICKLER FETCH" operation means that most likely the XMLType storage is BASICFILE CLOB, therefore greatly limiting the range of optimization techniques that Oracle could apply.
    You can confirm what the current storage is by looking at the table DDL, as Jason asked.
    CLOB storage is deprecated now in favor of SECUREFILE BINARY XML (the default in 11.2.0.2).
    Migrating the column to BINARY XML should give you a first significant improvement in the query.
    If the query is actually a recurring task, then it may further benefit from a structured XML index.
    Here's a small test case :
    create table xml_data nologging as
    select level as pk_id, xmlparse(document '<DATAGROUP>
        <PERSON>
            <BUSINESS_ID>'||to_char(level)||'</BUSINESS_ID>
            <INITIALS>M.</INITIALS>
            <NAME>Testperson</NAME>
            <BIRTHDATE>1977-12-12T00:00:00</BIRTHDATE>
            <GENDER>F</GENDER>
            <TELEPHONE>
                <COUNTRYCODE>34</COUNTRYCODE>
                <AREACODE>06</AREACODE>
                <LOCALCODE>'||to_char(trunc(dbms_random.value(1,10000)))||'</LOCALCODE>
            </TELEPHONE>
        </PERSON>
    </DATAGROUP>' wellformed) as datagroup
    from dual
    connect by level <= 100000 ;
    create index xml_data_sxi on xml_data (datagroup) indextype is xdb.xmlindex
    parameters (q'{
    XMLTABLE xml_data_xtab '/DATAGROUP/PERSON'
    COLUMNS countrycode number path 'TELEPHONE/COUNTRYCODE',
            areacode    number path 'TELEPHONE/AREACODE',
            localcode   number path 'TELEPHONE/LOCALCODE',
            business_id number path 'BUSINESS_ID'
    call dbms_stats.gather_table_stats(user, 'XML_DATA');
    SQL> set autotrace traceonly
    SQL> set timing on
    SQL> select pk_id
      2       , business_id
      3       , totalcount
      4  from (
      5    select t.pk_id
      6         , x.business_id
      7         , count(*) over (partition by x.countrycode, x.areacode, x.localcode) totalcount
      8    from xml_data t
      9       , xmltable(
    10           '/DATAGROUP/PERSON'
    11           passing t.datagroup
    12           columns countrycode number path 'TELEPHONE/COUNTRYCODE'
    13                 , areacode    number path 'TELEPHONE/AREACODE'
    14                 , localcode   number path 'TELEPHONE/LOCALCODE'
    15                 , business_id number path 'BUSINESS_ID'
    16         ) x
    17    where x.localcode is not null
    18  ) v
    19  where v.totalcount > 1 ;
    99998 rows selected.
    Elapsed: 00:00:03.79
    Execution Plan
    Plan hash value: 3200397756
    | Id  | Operation            | Name          | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT     |               |   100K|  3808K|       |  2068   (1)| 00:00:25 |
    |*  1 |  VIEW                |               |   100K|  3808K|       |  2068   (1)| 00:00:25 |
    |   2 |   WINDOW SORT        |               |   100K|  4101K|  5528K|  2068   (1)| 00:00:25 |
    |*  3 |    HASH JOIN         |               |   100K|  4101K|  2840K|   985   (1)| 00:00:12 |
    |   4 |     TABLE ACCESS FULL| XML_DATA      |   100K|  1660K|       |   533   (1)| 00:00:07 |
    |*  5 |     TABLE ACCESS FULL| XML_DATA_XTAB |   107K|  2616K|       |   123   (1)| 00:00:02 |
    Predicate Information (identified by operation id):
       1 - filter("V"."TOTALCOUNT">1)
       3 - access("T".ROWID="SYS_SXI_0"."RID")
       5 - filter("SYS_SXI_0"."LOCALCODE" IS NOT NULL)
    Statistics
              0  recursive calls
              1  db block gets
           2359  consistent gets
            485  physical reads
            168  redo size
        2352128  bytes sent via SQL*Net to client
          73746  bytes received via SQL*Net from client
           6668  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
          99998  rows processed
    If the above is still not satisfying then you can try structured storage (schema-based).

Maybe you are looking for

  • How to measure the rotational speed by using rotary encoder and 1 counter?

    I want to measure the rotational speed of a shaft, and I have below hardware: 1, a rotary encoder, with A,B,Z signals output; 2, PCI-E6363 card. I do konw how to use such a  encoder to measure the rotational angle by using the function "DAQmxCreateCI

  • How do I delete an App that did not fully install and Will Not delete in the usual fashion?

    Has anyone experienced this situation: you download an App; supposedly completed it shows up on my home screen with an icon that says "loading". It cannot be opened or deleted. I'm trying to figure out how to get rid of it. It happened to be the Cost

  • I cant start my computer any more

    I have a HP pavilion laptop. I wake up yesterday and found that  Microsoft apdated my windows 8 to windows 8.1 over night. the computer told me to restart and I did. Now i cant start my computer any more. I rceiveid this mensage:  BOOT DEVICE NOT FOU

  • Oracle 10.2.0.3.0 - impdp - Unusable index exists on unique/primary ...

    Hi All, Oracle 10.2.0.3.0 - during impdp the following failure appears: Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT ORA-39083: Object type CONSTRAINT failed to create with error: ORA-14063: Unusable index exists on unique/primary

  • Starting and stopping SAP J2EE Engine

    Hi guys,          I have downloaded and installed trial version of SAP Web Application Server (SAP Web AS) Java 6.40 for Microsoft Windows XP.    I wanted to launch SAP J2EE Engine and Software Deployment Manager (SDM) to run my web dynpro applicatio