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).
Similar Messages
-
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?> -
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 "<". 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 "<"). 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 -
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> -
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'
- NasarMark,
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' -
Free order of tags when deserialising XML-data using Simple Transformatiosn
Hi everybody,
I'm consuming a WebService and get something like this XML-data in the response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getSalesResponse>
<getSalesReturn href="#id0"/>
</getSalesResponse>
<multiRef id="id0">
<customer href="#id1"/>
<salesOrg href="#id2"/>
<salesRecord soapenc:arrayType="SalesRecord[2]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<salesRecord href="#id3"/>
<salesRecord href="#id4"/>
</salesRecord>
</multiRef>
<multiRef id="id1"><customer>124843</customer></multiRef>
<multiRef id="id2"><salesOrg>0001</salesOrg></multiRef>
<multiRef id="id3"><material>mat1</material></multiRef>
<multiRef id="id4"><material>mat2</material></multiRef>
</soapenv:Body>
</soapenv:Envelope>
</xml>
I've written a Simple Transformation: it fills my fields i_customer, i_salesorg, i_mat1 and i_mat2 from this XML-Data from the content of the <multiRef>-tags. But only if the order is exactly like this:
<multiRef><customer><tt:value ref="I_CUSTOMER"/>
</customer></multiRef>
<multiRef><salesOrg><tt:value ref="I_SALESORG"/>
</salesOrg></multiRef>
<multiRef><material><tt:value ref="I_MATERIAL1"/>
</material></multiRef>
<multiRef><material><tt:value ref="I_MATERIAL2"/>
</material></multiRef>
However the WebService doesn't guarantee a certain order for the <multiRef>-tags. That means the salesOrg could be contained ahead of the customer.
In a next step I've tried to use the command '<tt:group>' that allows free order of the first two elements:
<tt:group>
<tt:d-cond frq="1">
<multiRef><customer><tt:value ref="I_CUSTOMER"/>
</customer></multiRef>
</tt:d-cond>
<tt:d-cond frq="1">
<multiRef><salesOrg><tt:value ref="I_SALESORG"/>
</salesOrg></multiRef>
</tt:d-cond>
</tt:group>
<multiRef><material><tt:value ref="I_MATERIAL1"/>
</material></multiRef>
<multiRef><material><tt:value ref="I_MATERIAL2"/>
</material></multiRef>
However the WebService doesn't guarantee any order for the <multiRef>-tags. That means the first material could be contained ahead of the customer.
How can I insert the lines for my materials into to <tt:group>-command? Actually the WebService could deliever n materials, so I tried this (but that didn't work any more):
<tt:group>
<tt:d-cond frq="1">
<multiRef><customer><tt:value ref="I_CUSTOMER"/>
</customer></multiRef>
</tt:d-cond>
<tt:d-cond frq="1">
<multiRef><salesOrg><tt:value ref="I_SALESORG"/>
</salesOrg></multiRef>
</tt:d-cond>
<tt:d-cond frq="*">
<tt:loop name="tab" ref=".IT_MATERIALS">
<multiRef><material><tt:value ref="$tab.MATERIAL"/>
</material></multiRef>
</tt:loop>
</tt:d-cond>
Any help would be greatly appreciated. My colleagues have already begun to leave the office because I look more and more frustrated...
Greeting from Munich,
markus
Message was edited by: Markus Jarasch
Message was edited by: Markus JaraschI have some Interface Mapping questions I was hoping someone could help me with. As you know, my source is an XML File and my target is an OracleDB. I'll start with the "EFFECTIVEDATE" field which was automatically mapped when I added the Source and Target Datastores. As I previously mentioned, this caused an error "Target Column EFFECTIVEDATE: Data may be truncated: the target Column is smaller than the source Column". After looking further into it, would the problem be that the "EFFECTIVEDATE" datatype in the XML is "DATETIME" whereas the "EFFECTIVEDATE" datatype in the database is "TIMESTAMP"? If so, what would be the fix for this? Could I convert it in the Implemenation Mapping like so? -
CONVERT(MONEY.EFFECTIVEDATE,TIMESTAMP)
Would using that in the Implementation simply do the trick?
Anyway, moving onto some of the other TARGET fields...
-ACTIVITYGUID
This should be an automatically generated new GUID value. How could I implement this into the Implementation?
-TRANSACTIONGUID
I'll need to query some of the other tables in the database in order to get this value. Is this allowed in the Implemenation? Do I have to add said tables to the target somehow? Can I just query the other tables in the Implementation field using normal select statements, etc.? I'm a bit confused on how this would work...
-TYPECODE
This needs to be a fixed value of '01'. How do I simply do that in the Implementation?
The other fields will all be implemented similar to the above so those are the main questions I have for now. Any help would be appreciated.
Thanks again for your help. -
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] -
I am getting the following error when loading xml datafile to my Oracle XE database table. This data I exported from htmldb.oracle.com.
ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00222: error received from SAX callback function
please help
GeorgeGeorge,
I expect that this is simply an incompatibility with the date format that was used for XML Import/Export as part of XE Beta. This is a bug that has been fixed for XE production and you will be able to freely export from HTML DB 2.0 and import into XE and vice versa.
Your NLS settings do not control this. The date format used for XML Export is fixed - a canonical date format is always used.
If you want to be able to import into XE Beta, your date fields probably look like:
<HIREDATE>2005-12-03T00:00:00.000</HIREDATE>Just remove the trailing .000 from your date entries.
<HIREDATE>2005-12-03T00:00:00</HIREDATE>
Note: This will only be necessary for XE Beta. You should not have to do this for XE Production.
Joel -
Placing a parameter for a report in header when no XML data returned
Good Afternoon ~
I have a request from a user that requires the need to place a reports parameters in the header of the report even though the report may return no data. Example of this would be a missing time card report.
I have only seen the use of this when there is data returned. If the report returns no data there is no XML.
I have no idea how I would accomplish this. Any suggestions I can get on this is much appreciated. How would I capture the parameter used?
Thank you much!
GApparently I am not notified of these updates. Sorry this took me a bit to get to you.
The report data is using an Oracle Report to generate the XML. All other formatting is done in BI Publisher. -
Error when querying OLAP data with BI answers
Have been doing all the Lessons in "Using Oracle OLAP With Oracle BI Enterprise Edition 10g Release 3". Got till lesson 3 where I'm supposed to query the data with Answers but If I add any of the facts to the report, I get the following error:
Odbc driver returned an error (SQLExecDirectW).
Error Details
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17003] Oracle gateway error: Unsupported data type 101. (HY000)
SQL Issued: SELECT Customer."Ship To" saw_0, Measures.COST saw_1 FROM Global ORDER BY saw_0
So I was wondering if anyone knows what the catch could be.
Thanks in advance!Yes. Me too. I have the same issue and I don't find any information about it. Could anyone help ?
-
Low performances when querying data dictionary Oracle 11g
Query:
SELECT
ucc_fk.column_name FK_COLUMN_NAME,
ucc_pk.table_name PK_TABLE_NAME,
ucc_pk.column_name PK_COLUMN_NAME
FROM user_constraints uc_fk
INNER JOIN user_cons_columns ucc_fk ON (ucc_fk.constraint_name = uc_fk.constraint_name)
INNER JOIN user_constraints uc_pk ON (uc_pk.constraint_name = uc_fk.r_constraint_name)
INNER JOIN user_cons_columns ucc_pk ON (ucc_pk.constraint_name = uc_fk.r_constraint_name AND ucc_pk.position = ucc_fk.position)
WHERE
uc_fk.constraint_type = 'R' AND
uc_pk.constraint_type = 'P' AND
uc_fk.table_name = 'TABLE_NAME';
works ok on 10g but is very slow on 11g? How to improve performances?You dont need to join with user_constraints again unless you are trying to avoid references to a unique key.
SELECT ucc_fk.column_name FK_COLUMN_NAME, ucc_pk.table_name PK_TABLE_NAME, ucc_pk.column_name PK_COLUMN_NAME
FROM user_constraints uc_fk
JOIN user_cons_columns ucc_fk
ON (ucc_fk.constraint_name = uc_fk.constraint_name)
JOIN user_cons_columns ucc_pk
ON (ucc_pk.constraint_name = uc_fk.r_constraint_name
AND ucc_pk.position = ucc_fk.position)
WHERE uc_fk.constraint_type = 'R'
AND uc_fk.table_name = 'TABLE_NAME';As you can see I have removed the join to user_constraints and hence the condition uc_pk.constraint_type = 'P'
The reason being the it is already validated to be in ('P','U') for all r_constraint_names.
G. -
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. -
Binding data when using xml data files
Hello,
I am pretty new to Flex4 and hope you hang on with my question. MAny thanks:
I built an application first with PHP connection into a database which essentially listed IP of my company in a grid.
One could filter the IP depending of technology, type of Ip and so on.
When clicking in the grid, the details with many more fileds would apprear. This was working niceley as I had my services defined and needed only to drag services in the right place and add here and there some changes in the code
Now, I wanted to do the same with an xml file instead of a mySQL database so to deploy it a little easier.
I have the grid and the filtering working nicely.
But I cannot create the data binding for the details.
Below is the code. See the line before last where I tested if I could access to the descriptipn fuield in my arrayCollection (coming from my xml)
CAn anyone help me, please
many thanks in advance and best regards
Peter
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="myServ.send()" width="900" height="500">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.ListEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import spark.events.TextOperationEvent;
[Bindable]
private var myIPList:ArrayCollection;
protected function myServ_faultHandler(event:FaultEvent):void
Alert.show("Something went wrong", "Cannot load data");
protected function myServ_resultHandler(event:ResultEvent):void
if(event.result.test.IP is ArrayCollection){
this.myIPList = event.result.test.IP as ArrayCollection;
}else{
var buffer:ArrayCollection = new ArrayCollection([event.result.test.IP]);
this.myIPList = buffer;
this.searchInput.enabled = false;
this.searchInputTechnology.enabled = false;
this.searchInputProvider.enabled = false;
// serach for IP
protected function searchInput_changeHandler(event:TextOperationEvent):void
this.myIPList.filterFunction = filterFunc;
this.myIPList.refresh();
private function filterFunc(item:Object):Boolean
if(String(item.IP).toLowerCase().indexOf(this.searchInput.text.toLowerCase()) > -1){
return true;
}else{
return false;
// Search for Technology
protected function searchInputTechnology_changeHandler(event:TextOperationEvent):void
this.myIPList.filterFunction = filterFuncTechnology;
this.myIPList.refresh();
private function filterFuncTechnology(item:Object):Boolean
if(String(item.Technology).toLowerCase().indexOf(this.searchInputTechnology.text.toLowerCa se()) > -1){
return true;
}else{
return false;
// Search for Provider
protected function searchInputProvider_changeHandler(event:TextOperationEvent):void
this.myIPList.filterFunction = filterFuncProvider;
this.myIPList.refresh();
private function filterFuncProvider(item:Object):Boolean
if(String(item.Provider).toLowerCase().indexOf(this.searchInputProvider.text.toLowerCase() ) > -1){
return true;
}else{
return false;
protected function myDG_changeHandler(event:ListEvent):void
Alert.show("I Clicked. It should now be possible to see details, damned");
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="myServ" url="IP.xml" fault="myServ_faultHandler(event)" result="myServ_resultHandler(event)"/>
</fx:Declarations>
<mx:DataGrid id="myDG" change="myDG_changeHandler(event)" x="37" y="134" width="814" height="159" dataProvider="{this.myIPList}">
<mx:columns>
<mx:DataGridColumn headerText="IP" dataField="IP"/>
<mx:DataGridColumn headerText="short description" dataField="detail"/>
<mx:DataGridColumn headerText="type" dataField="type"/>
<mx:DataGridColumn headerText="Provider" dataField="Provider"/>
<mx:DataGridColumn headerText="Technology" dataField="Technology"/>
</mx:columns>
</mx:DataGrid>
<s:HGroup x="33" y="74" width="152" height="41" verticalAlign="middle">
<mx:Spacer width="100%">
</mx:Spacer>
<s:Label text="IP"/>
<s:TextInput id="searchInput" change="searchInput_changeHandler(event)" width="103"/>
</s:HGroup>
<s:HGroup x="686" y="74" width="153" height="41" verticalAlign="middle">
<mx:Spacer width="100%">
</mx:Spacer>
<s:Label text="Technology"/>
<s:TextInput id="searchInputTechnology" change="searchInputTechnology_changeHandler(event)" width="94"/>
</s:HGroup>
<s:HGroup x="519" y="74" width="153" height="41" verticalAlign="middle">
<mx:Spacer width="100%">
</mx:Spacer>
<s:Label text="Provider"/>
<s:TextInput id="searchInputProvider" change="searchInputProvider_changeHandler(event)" width="94"/>
</s:HGroup>
<s:Label x="135" y="38" text="IP Road Map" fontSize="29" color="#524E4E"/>
<s:TextArea id="myText" x="37" y="315" width="204" text="{this.myIPList}" height="164"/>
<mx:Image x="33" y="18" width="74" height="57" id="STLogo" source="file:/Users/peterhirt/Pictures/stlogo.png"/>
</s:Application>
Here at tzhe end I append one record out of the xml files I used
<?xml version="1.0" encoding="utf-8" ?>
<test>
<IP>
<IP>USB2 PHY</IP>
<detail>single port </detail>
<type>USB</type>
<Provider>TR&D</Provider>
<Technology>65lp</Technology>
<maturity_status>MAT20</maturity_status>
<status_date>Q4/09</status_date>
<next_Maturity>MAT30</next_Maturity>
<next_Date></next_Date>
<HED>y</HED>
<HED_criticality>2</HED_criticality>
<HED_MAT20_request>Q4/09</HED_MAT20_request>
<CCI></CCI>
<CCI_criticality></CCI_criticality>
<_CCI_MAT20_request></_CCI_MAT20_request>
<APG></APG>
<APG_criticality></APG_criticality>
<APG_MAT20_request></APG_MAT20_request>
<STE></STE>
<STE_criticality></STE_criticality>
<STE_MAT20_request></STE_MAT20_request>
<IMS></IMS>
<IMS_criticality></IMS_criticality>
<IMS_MAT20_request></IMS_MAT20_request>
</IP>Hi Kevin,
the current XML export version is admittedly not suitable for handling HTML data, as it doesn´t put any data inside CDATA sections.
How can I strip out this HTML using the XML export?
I´m not aware of this functionality, but I´m sure it would have to be integrated into the respective "includes" files in order to become effective.
However, you might consider using the manual "converting database queries to XML" approach explained on this page: http://labs.adobe.com/technologies/spry/samples/utils/query2xml.html -- this will give you notably more freedom to e.g. preprocess some data before it´s getting stuffed inside an XML node.
I am pulling RSS feeds from news sites and storing the rss items in a database
Would it be possible to rather sanitize the data before it´s getting stored in the database ?
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
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> -
MailboxExportRequest ContentFilter is "Received -ne $null" when querying by date.
I am trying to export a mailbox to a PST. All email that was received before
yesterday is what I am trying to export.
$y = ((get-date).addDays(-1)).ToShortDateString()$exportRequest = New-MailboxExportRequest -ContentFilter {(Received -lt $y)} -mailbox userID -FilePath\\SHARED\folder\userID.pst
Something is not right here. I end up exporting the entire mailbox.
When I run a:
Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | select ContentFilter
It says that my content filter is:
Received -ne $null
I am sure something is wrong with my syntax here, but I can't seem to get it.Hi Johnny,
Please checkout this MS-Library to find the correct syntax for exporting mailbox to PST:
http://technet.microsoft.com/en-us/library/ff607299(v=exchg.150).aspx
Another good resource you can explore at here(http://www.exchangemailboxtopst.org/) which will make your task more easier while need to export mailboxes to PST.
Maybe you are looking for
-
So a couple of months ago, I had to restore my new IPOD 5 TOUCH because i had forgotten the password and disabled it, so as you can imagine I am quite familiar with restoring it. (The last time I had synced it was the only time that I had to restore
-
I have Adobe acrobat pro extended plug in and microsoft silverlight plug in installed fine on my firefox , however it seems doesn't work . How to check them ? I knew doesn't work , because when i am using IE , i can click right mouse button, then opt
-
Problem in FM SO_DOCUMENT_SEND_API1
Dear All I am using FM SO_DOCUMENT_SEND_API1 to send excel attachment in a mail. The data is coming correctly but data in one column is coming in distorted format with lot of spaces that are not given at any point. I used 'CONDENSE' in all fields but
-
Drawing TrendLines in Line Chart
Hi, I am using a Line Chart in one of my projects. I use a HTTPService to fetch XML Data to feed the chart. <mx:HTTPService id="myServ" url="ChartData.xml" result="myResultHandler(event)"/> I draw two trend lines over the chart based on the max & min
-
So when I plug my ipod nano into my computer usb port it say it has malfunctioned and windows doesnt recognize it. I've tried everything possible also i cant see it on itunes or ipod updater. PLEASE HELP. Thank YOU