Creating Indexes within an XMLType column
Hi,
I have following XML document stored as XMLType column,
<ocaStatus xmlns="http://xmlbeans.apache.org/ocastatus"><status><statusCode>934</statusCode><statusDate>Wed Apr 07 16:05:53 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>934</statusCode><statusDate>Wed Apr 07 15:58:25 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>934</statusCode><statusDate>Wed Apr 07 15:54:02 GMT+05:30 2010</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>750</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Document Metadata is correct.</comment></status><status><statusCode>934</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Sent to LTC</comment></status><status><statusCode>932</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Loaded to Novus</comment></status><status><statusCode>700</statusCode><statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate><userId>u0121845</userId><comment>Document is deleted from OCA.</comment></status></ocaStatus>
I created following Indexes within the XML,
CREATE INDEX "OCA_DEV"."OCA_STATUS_CODE_INDEX" ON "OCA_DEV"."DOCUMENT_STATUS_XML" (EXTRACTVALUE('/ocaStatus/status/statusCode'));
CREATE INDEX "OCA_DEV"."OCA_STATUS_DATE_INDEX" ON "OCA_DEV"."DOCUMENT_STATUS_XML" (EXTRACTVALUE('/ocaStatus/status/statusDate'));
However the problem is that I will be having multiple status within each XML which violates the Indexing.
Is there any way I can still create the Indexes allowing multiple status values in each XML?
Thanks in advance.
Hi,
You may want to store your document as a schema-based, object-relational XMLType to achieve that.
Then you'll be able to create indexes on the nested table used to store each "status" element.
Here's an example based on your sample document.
1) First, create and register a schema. The following is basic but sufficient here, let's call it "ocastatus.xsd" :
<?xml version="1.0"?>
<xsd:schema
targetNamespace="http://xmlbeans.apache.org/ocastatus"
xmlns="http://xmlbeans.apache.org/ocastatus"
elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb">
<xsd:element name="ocaStatus" type="OCASTATUS_TYPEType"/>
<xsd:complexType name="OCASTATUS_TYPEType" xdb:SQLType="OCASTATUS_TYPE">
<xsd:sequence>
<xsd:element name="status" type="STATUS_TYPEType" xdb:SQLName="status" maxOccurs="unbounded" xdb:SQLCollType="STATUS_V"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="STATUS_TYPEType" xdb:SQLType="STATUS_TYPE">
<xsd:sequence>
<xsd:element name="statusCode" type="xsd:double" xdb:SQLName="statusCode" xdb:SQLType="NUMBER"/>
<xsd:element name="statusDate" xdb:SQLName="statusDate" xdb:SQLType="VARCHAR2">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="userId" xdb:SQLName="userId" xdb:SQLType="VARCHAR2">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="comment" xdb:SQLName="comment" xdb:SQLType="VARCHAR2">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>Registering...
BEGIN
dbms_xmlschema.registerSchema(
schemaURL => 'ocastatus.xsd',
schemaDoc => xmltype(bfilename('XSD_DIR','ocastatus.xsd'), nls_charset_id('AL32UTF8')),
genTypes => true,
genTables => false
END;2) Table definition :
CREATE TABLE oca_status (
num NUMBER,
doc XMLTYPE
XMLTYPE doc STORE AS OBJECT RELATIONAL
XMLSCHEMA "ocastatus.xsd"
ELEMENT "ocaStatus"
VARRAY doc.xmldata."status" STORE AS TABLE oca_status_tab
CREATE INDEX oca_status_tab_idx1 ON oca_status_tab("statusCode");
CREATE INDEX oca_status_tab_idx2 ON oca_status_tab("statusDate");3) Inserting document...
INSERT INTO oca_status (num, doc)
VALUES(1, xmltype('<ocaStatus xmlns="http://xmlbeans.apache.org/ocastatus">
<status>
<statusCode>934</statusCode>
<statusDate>Wed Apr 07 16:05:53 GMT+05:30 2010</statusDate>
<userId>u0121845</userId>
<comment>Sent to LTC</comment>
</status>
<status>
<statusCode>934</statusCode>
<statusDate>Wed Apr 07 15:58:25 GMT+05:30 2010</statusDate>
<userId>u0121845</userId>
<comment>Sent to LTC</comment>
</status>
<status>
<statusCode>934</statusCode>
<statusDate>Wed Apr 07 15:54:02 GMT+05:30 2010</statusDate>
<userId>u0121845</userId>
<comment>Sent to LTC</comment>
</status>
<status>
<statusCode>750</statusCode>
<statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate>
<userId>u0121845</userId>
<comment>Document Metadata is correct.</comment>
</status>
<status>
<statusCode>934</statusCode>
<statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate>
<userId>u0121845</userId>
<comment>Sent to LTC</comment>
</status>
<status>
<statusCode>932</statusCode>
<statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate>
<userId>u0121845</userId>
<comment>Loaded to Novus</comment>
</status>
<status>
<statusCode>700</statusCode>
<statusDate>2010-03-31 12:39:41.580 GMT+05:30</statusDate>
<userId>u0121845</userId>
<comment>Document is deleted from OCA.</comment>
</status>
</ocaStatus>')
);Verifying index use (XPath rewrite) ...
SQL> EXPLAIN PLAN FOR
2 SELECT * from oca_status x
3 WHERE existsnode(x.doc, '//status[statusCode="934"]') = 1;
Explicité.
SQL> SELECT * FROM TABLE(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 1840289382
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 7938 | 4 (25)| 00:00:01 |
|* 1 | TABLE ACCESS FULL | OCA_STATUS_TAB | 1 | 2145 | 4 (0)| 00:00:01 |
| 2 | NESTED LOOPS | | 1 | 7938 | 4 (25)| 00:00:01 |
| 3 | SORT UNIQUE | | 4 | 8580 | 2 (0)| 00:00:01 |
| 4 | TABLE ACCESS BY INDEX ROWID| OCA_STATUS_TAB | 4 | 8580 | 2 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | OCA_STATUS_TAB_IDX1 | 4 | | 1 (0)| 00:00:01 |
| 6 | TABLE ACCESS BY INDEX ROWID | OCA_STATUS | 1 | 5793 | 1 (0)| 00:00:01 |
|* 7 | INDEX UNIQUE SCAN | SYS_C00243981 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter("NESTED_TABLE_ID"=:B1)
5 - access("statusCode"=934)
7 - access("NESTED_TABLE_ID"="X"."SYS_NC0000900010$")
Note
- dynamic sampling used for this statement
25 ligne(s) sélectionnée(s).
SQL> Regards.
Similar Messages
-
How to create index on a xmltype column stored as CLOB
actually i have two problems.
i uploaded this schemaA.xsd file into xmldb repository without problems. registration also went ok.
BEGIN
DBMS_XMLSCHEMA.registerSchema(
schemaURL => 'http://xmlns.example.com/xdb/documentation/schemaA.xsd'
,schemaDoc => sys.UriFactory.getUri('/home/dev/schemaA.xsd')
,local => TRUE
,genBean => false
,genTypes => TRUE
,genTables => false
,enableHierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
END;
then i run this:
create table pf_table_a(
id VARCHAR2(100) primary key,
xsd VARCHAR2(3000),
xml_document XMLType
) XMLTYPE COLUMN xml_document
STORE AS CLOB
XMLSCHEMA "http://xmlns.example.com/xdb/documentation/schemaA.xsd"
ELEMENT "order";
and got this error:
SQL> @d:\usr\dev\perftest\create_tables.sql
Table created.
create table pf_table_a(
ERROR at line 1:
ORA-00955: name is already used by an existing object
anyway the table was created. so i went on to create indexes.
SQL> create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@or
derNo'));
create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@orderNo
ERROR at line 1:
ORA-04063: table "BAUSER1.PF_TABLE_A" has errors
this of course is wrong. because the command is for creating index of a XMLTYPE table. no a column. but what is the correct command? thanks.
jack.actually i have two problems.
i uploaded this schemaA.xsd file into xmldb repository without problems. registration also went ok.
BEGIN
DBMS_XMLSCHEMA.registerSchema(
schemaURL => 'http://xmlns.example.com/xdb/documentation/schemaA.xsd'
,schemaDoc => sys.UriFactory.getUri('/home/dev/schemaA.xsd')
,local => TRUE
,genBean => false
,genTypes => TRUE
,genTables => false
,enableHierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
END;
then i run this:
create table pf_table_a(
id VARCHAR2(100) primary key,
xsd VARCHAR2(3000),
xml_document XMLType
) XMLTYPE COLUMN xml_document
STORE AS CLOB
XMLSCHEMA "http://xmlns.example.com/xdb/documentation/schemaA.xsd"
ELEMENT "order";
and got this error:
SQL> @d:\usr\dev\perftest\create_tables.sql
Table created.
create table pf_table_a(
ERROR at line 1:
ORA-00955: name is already used by an existing object
anyway the table was created. so i went on to create indexes.
SQL> create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@or
derNo'));
create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@orderNo
ERROR at line 1:
ORA-04063: table "BAUSER1.PF_TABLE_A" has errors
this of course is wrong. because the command is for creating index of a XMLTYPE table. no a column. but what is the correct command? thanks.
jack. -
Create Foregn Key on xmltype column
I get ora-00904 while executing following code. I have created hematest table on registerd schema.
alter table hematest
add constraint valid_area
foreign key (xmldata."area") references test_are(area_test);I am sending script for my xm schema, xml type table based on the registered schema , oracle relational table that foreign key is references and script for generating foreign key.
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.domain name/fraamed_test/event_start.xsd" xmlns:event_start="http://www.domain name/fraamed_test/event_start.xsd" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:flags="7" oraxdb:schemaURL="http://www.domain name/fraamed_test/event_start.xsd" oraxdb:schemaOwner="FRAAMED_TEST" oraxdb:numProps="55">
<annotation>
<documentation>
All date tags are formatted YYYY-MM-DD.
All time tags are formatted HH:MM:SS. Note: SS can be set to 00 when not needed.
The event_link is the linking number that links several events together that are involved in the same
mission being performed at the same scheduled time. This can be anything as long as it is numeric.
It is recommended that and event_identifier from one of the events being linked together be used. To
be linked all events doing the same mission need this tag filled and it must be the same value for all
the linked events, including the one that may have the same event_identifier.
The status are the following: P-Pending, SA-Squadron Authorized, AA-AirOpds Authroized,
IP-InProgress, F-Finished, C-Cancelled, P-Postponed, D-Deleted, R-Rescheduled.
The status_code is a code that to provide further information about a given status. In particular it
should be used when a status of C, P, D, or R is used.
The airfield_location is a runway number or field location like grass, gravel, etc.
</documentation>
</annotation>
<element name="event_start" oraxdb:propNumber="5125" oraxdb:global="true" oraxdb:SQLName="event_start" oraxdb:SQLType="event_start1290_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:defaultTable="event_start1306_TAB" oraxdb:defaultTableSchema="FRAAMED_TEST">
<complexType oraxdb:SQLType="event_start1290_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="location" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5071" oraxdb:global="false" oraxdb:SQLName="location" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="15"/>
<minLength value="2"/>
</restriction>
</simpleType>
</element>
<element name="sending_system" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5072" oraxdb:global="false" oraxdb:SQLName="sending_system" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="10"/>
<minLength value="2"/>
</restriction>
</simpleType>
</element>
<element name="transaction_date" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5075" oraxdb:global="false" oraxdb:SQLName="transaction_date" oraxdb:SQLType="transaction_date1291_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<complexType oraxdb:SQLType="transaction_date1291_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="date" minOccurs="1" maxOccurs="1" type="date" oraxdb:propNumber="5073" oraxdb:global="false" oraxdb:SQLName="date" oraxdb:SQLType="DATE" oraxdb:memType="12" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<element name="time" minOccurs="1" maxOccurs="1" type="time" oraxdb:propNumber="5074" oraxdb:global="false" oraxdb:SQLName="time" oraxdb:SQLType="TIMESTAMP" oraxdb:memType="180" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
</sequence>
</complexType>
</element>
<element name="event_identifier" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5076" oraxdb:global="false" oraxdb:SQLName="event_identifier" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="positiveInteger">
<maxInclusive value="999999999999"/>
</restriction>
</simpleType>
</element>
<element name="event_link" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5077" oraxdb:global="false" oraxdb:SQLName="event_link" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="positiveInteger">
<maxInclusive value="999999999999"/>
</restriction>
</simpleType>
</element>
<element name="organization_code" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5078" oraxdb:global="false" oraxdb:SQLName="organization_code" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="25"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="scheduled_time" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5082" oraxdb:global="false" oraxdb:SQLName="scheduled_time" oraxdb:SQLType="scheduled_time1292_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<complexType oraxdb:SQLType="scheduled_time1292_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="date" minOccurs="1" maxOccurs="1" type="date" oraxdb:propNumber="5079" oraxdb:global="false" oraxdb:SQLName="date" oraxdb:SQLType="DATE" oraxdb:memType="12" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<element name="time" minOccurs="1" maxOccurs="1" type="time" oraxdb:propNumber="5080" oraxdb:global="false" oraxdb:SQLName="time" oraxdb:SQLType="TIMESTAMP" oraxdb:memType="180" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<element name="event_duration_minutes" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5081" oraxdb:global="false" oraxdb:SQLName="event_duration_minutes" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="positiveInteger">
<maxInclusive value="3600"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
</element>
<element name="actual_event_end_time" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5085" oraxdb:global="false" oraxdb:SQLName="actual_event_end_time" oraxdb:SQLType="actual_event_end_time1293_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<complexType oraxdb:SQLType="actual_event_end_time1293_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="date" minOccurs="1" maxOccurs="1" type="date" oraxdb:propNumber="5083" oraxdb:global="false" oraxdb:SQLName="date" oraxdb:SQLType="DATE" oraxdb:memType="12" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<element name="time" minOccurs="1" maxOccurs="1" type="time" oraxdb:propNumber="5084" oraxdb:global="false" oraxdb:SQLName="time" oraxdb:SQLType="TIMESTAMP" oraxdb:memType="180" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
</sequence>
</complexType>
</element>
<element name="status" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5086" oraxdb:global="false" oraxdb:SQLName="status" oraxdb:SQLType="XDB$ENUM_T" oraxdb:SQLSchema="XDB" oraxdb:memType="259" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<enumeration value="P"/>
<enumeration value="SA"/>
<enumeration value="AA"/>
<enumeration value="IP"/>
<enumeration value="F"/>
<enumeration value="C"/>
<enumeration value="P"/>
<enumeration value="D"/>
<enumeration value="R"/>
</restriction>
</simpleType>
</element>
<element name="overbooked" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5087" oraxdb:global="false" oraxdb:SQLName="overbooked" oraxdb:SQLType="XDB$ENUM_T" oraxdb:SQLSchema="XDB" oraxdb:memType="259" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<enumeration value="Y"/>
<enumeration value="N"/>
</restriction>
</simpleType>
</element>
<element name="status_reason_code" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5088" oraxdb:global="false" oraxdb:SQLName="status_reason_code" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="15"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="tms" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5089" oraxdb:global="false" oraxdb:SQLName="tms" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="10"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="bureau_number" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5090" oraxdb:global="false" oraxdb:SQLName="bureau_number" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="6"/>
<minLength value="0"/>
<pattern value="[0-9]"/>
</restriction>
</simpleType>
</element>
<element name="side_number" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5091" oraxdb:global="false" oraxdb:SQLName="side_number" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="6"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="call_sign" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5092" oraxdb:global="false" oraxdb:SQLName="call_sign" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="40"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="takeoff_airfield" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5093" oraxdb:global="false" oraxdb:SQLName="takeoff_airfield" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="25"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="landing_airfield" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5094" oraxdb:global="false" oraxdb:SQLName="landing_airfield" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="25"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="mission_airfield" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5095" oraxdb:global="false" oraxdb:SQLName="mission_airfield" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="25"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="airfield_location" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5096" oraxdb:global="false" oraxdb:SQLName="airfield_location" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="25"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="squadron_authorizer" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5101" oraxdb:global="false" oraxdb:SQLName="squadron_authorizer" oraxdb:SQLType="squadron_authorizer1294_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<complexType oraxdb:SQLType="squadron_authorizer1294_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="salutation" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5097" oraxdb:global="false" oraxdb:SQLName="salutation" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="10"/>
<minLength value="1"/>
</restriction>
</simpleType>
</element>
<element name="first_name" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5098" oraxdb:global="false" oraxdb:SQLName="first_name" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="20"/>
<minLength value="1"/>
</restriction>
</simpleType>
</element>
<element name="last_name" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5099" oraxdb:global="false" oraxdb:SQLName="last_name" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="20"/>
<minLength value="1"/>
</restriction>
</simpleType>
</element>
<element name="title" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5100" oraxdb:global="false" oraxdb:SQLName="title" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="40"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
</element>
<element name="airops_authorizer" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5106" oraxdb:global="false" oraxdb:SQLName="airops_authorizer" oraxdb:SQLType="airops_authorizer1295_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<complexType oraxdb:SQLType="airops_authorizer1295_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="salutation" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5102" oraxdb:global="false" oraxdb:SQLName="salutation" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="10"/>
<minLength value="1"/>
</restriction>
</simpleType>
</element>
<element name="first_name" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5103" oraxdb:global="false" oraxdb:SQLName="first_name" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="20"/>
<minLength value="1"/>
</restriction>
</simpleType>
</element>
<element name="last_name" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5104" oraxdb:global="false" oraxdb:SQLName="last_name" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="20"/>
<minLength value="1"/>
</restriction>
</simpleType>
</element>
<element name="title" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5105" oraxdb:global="false" oraxdb:SQLName="title" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="40"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
</element>
<element name="project_code" minOccurs="0" maxOccurs="unbounded" oraxdb:propNumber="5107" oraxdb:global="false" oraxdb:SQLName="project_code" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true" oraxdb:SQLCollType="project_code1296_COLL" oraxdb:SQLCollSchema="FRAAMED_TEST">
<simpleType>
<restriction base="string">
<maxLength value="40"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="airspace" minOccurs="0" maxOccurs="unbounded" oraxdb:propNumber="5117" oraxdb:global="false" oraxdb:SQLName="airspace" oraxdb:SQLType="airspace1297_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false" oraxdb:SQLCollType="airspace1300_COLL" oraxdb:SQLCollSchema="FRAAMED_TEST">
<complexType oraxdb:SQLType="airspace1297_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="area" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5108" oraxdb:global="false" oraxdb:SQLName="area" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="20"/>
<minLength value="3"/>
</restriction>
</simpleType>
</element>
<element name="area_qualified" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5116" oraxdb:global="false" oraxdb:SQLName="area_qualified" oraxdb:SQLType="area_qualified1298_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<complexType oraxdb:SQLType="area_qualified1298_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="direction" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5109" oraxdb:global="false" oraxdb:SQLName="direction" oraxdb:SQLType="XDB$ENUM_T" oraxdb:SQLSchema="XDB" oraxdb:memType="259" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<enumeration value="N"/>
<enumeration value="S"/>
<enumeration value="E"/>
<enumeration value="W"/>
<enumeration value="NE"/>
<enumeration value="NW"/>
<enumeration value="SE"/>
<enumeration value="SW"/>
</restriction>
</simpleType>
</element>
<element name="exclusive" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5110" oraxdb:global="false" oraxdb:SQLName="exclusive" oraxdb:SQLType="XDB$ENUM_T" oraxdb:SQLSchema="XDB" oraxdb:memType="259" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<enumeration value="Y"/>
<enumeration value="N"/>
</restriction>
</simpleType>
</element>
<element name="min_altitude" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5111" oraxdb:global="false" oraxdb:SQLName="min_altitude" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="integer">
<maxInclusive value="9999999"/>
<minInclusive value="-999999"/>
</restriction>
</simpleType>
</element>
<element name="max_altitude" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5112" oraxdb:global="false" oraxdb:SQLName="max_altitude" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="integer">
<maxInclusive value="9999999"/>
<minInclusive value="-999999"/>
</restriction>
</simpleType>
</element>
<element name="area_time" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5115" oraxdb:global="false" oraxdb:SQLName="area_time" oraxdb:SQLType="area_time1299_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<complexType oraxdb:SQLType="area_time1299_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="time" minOccurs="1" maxOccurs="1" type="time" oraxdb:propNumber="5113" oraxdb:global="false" oraxdb:SQLName="time" oraxdb:SQLType="TIMESTAMP" oraxdb:memType="180" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true"/>
<element name="area_duration_minutes" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5114" oraxdb:global="false" oraxdb:SQLName="area_duration_minutes" oraxdb:SQLType="NUMBER" oraxdb:memType="2" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="positiveInteger">
<maxInclusive value="3600"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="mission" minOccurs="0" maxOccurs="unbounded" oraxdb:propNumber="5118" oraxdb:global="false" oraxdb:SQLName="mission" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true" oraxdb:SQLCollType="mission1301_COLL" oraxdb:SQLCollSchema="FRAAMED_TEST">
<simpleType>
<restriction base="string">
<maxLength value="25"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
<element name="resource_codes" minOccurs="0" maxOccurs="unbounded" oraxdb:propNumber="5123" oraxdb:global="false" oraxdb:SQLName="resource_codes" oraxdb:SQLType="resource_codes1302_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false" oraxdb:SQLCollType="resource_codes1304_COLL" oraxdb:SQLCollSchema="FRAAMED_TEST">
<complexType oraxdb:SQLType="resource_codes1302_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="resource" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5119" oraxdb:global="false" oraxdb:SQLName="resource" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="35"/>
<minLength value="1"/>
</restriction>
</simpleType>
</element>
<element name="resource_qualified" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5122" oraxdb:global="false" oraxdb:SQLName="resource_qualified" oraxdb:SQLType="resource_qualified1303_T" oraxdb:SQLSchema="FRAAMED_TEST" oraxdb:memType="258" oraxdb:SQLInline="true" oraxdb:MemInline="false" oraxdb:JavaInline="false">
<complexType oraxdb:SQLType="resource_qualified1303_T" oraxdb:SQLSchema="FRAAMED_TEST">
<sequence>
<element name="exclusive" minOccurs="1" maxOccurs="1" oraxdb:propNumber="5120" oraxdb:global="false" oraxdb:SQLName="exclusive" oraxdb:SQLType="XDB$ENUM_T" oraxdb:SQLSchema="XDB" oraxdb:memType="259" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<enumeration value="Y"/>
<enumeration value="N"/>
</restriction>
</simpleType>
</element>
<element name="location" minOccurs="0" maxOccurs="1" oraxdb:propNumber="5121" oraxdb:global="false" oraxdb:SQLName="location" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true">
<simpleType>
<restriction base="string">
<maxLength value="15"/>
<minLength value="1"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="comments" minOccurs="0" maxOccurs="unbounded" oraxdb:propNumber="5124" oraxdb:global="false" oraxdb:SQLName="comments" oraxdb:SQLType="VARCHAR2" oraxdb:memType="1" oraxdb:SQLInline="true" oraxdb:MemInline="true" oraxdb:JavaInline="true" oraxdb:SQLCollType="comments1305_COLL" oraxdb:SQLCollSchema="FRAAMED_TEST">
<simpleType>
<restriction base="string">
<maxLength value="4000"/>
<minLength value="0"/>
</restriction>
</simpleType>
</element>
</sequence>
</complexType>
</element>
</schema>
create table frmd_event_start(
event_start xmltype)
xmltype column event_start
XMLSCHEMA "www.domain name/fraamed_test/frmd_event_start.xsd"
element "event_start";
CREATE TABLE AREAS
AREA VARCHAR2(10 BYTE)
TABLESPACE FRMD_DEFAULT
PCTUSED 40
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
NOLOGGING
NOCACHE
NOPARALLEL;
CREATE UNIQUE INDEX PK_AREA ON AREAS
(AREA)
NOLOGGING
TABLESPACE FRMD_DEFAULT
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
NOPARALLEL;
ALTER TABLE AREAS ADD (
CONSTRAINT PK_AREA PRIMARY KEY (AREA)
USING INDEX
TABLESPACE FRMD_DEFAULT
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
SQL> alter table frmd_event_start
2 add constraint VALID_AREA
3 foreign key (xml_event_starts."area") references areas(area);
foreign key (xml_event_starts."area") references areas(area)
ERROR at line 3: -
DirectToXMLTypeMapping "create-tables" not generating XMLTYPE column type
Can someone tell me how to code an XMLTYPE field such that "create-tables" will generate the XMLTYPE column and such that the IntegrityChecker will not throw an error.
I am forced to run these alters after "create-tables" is run.
ALTER TABLE XML_SYS_MSG drop column message;
ALTER TABLE XML_SYS_MSG add (message XMLType);
Snippets:
<persistence...
<property name="eclipselink.ddl-generation" value="create-tables" />
</persistence>
public class XmlMessageCustomizer implements DescriptorCustomizer {
@Override
public void customize(final ClassDescriptor descriptor) throws Exception {
final DirectToXMLTypeMapping mapping = new DirectToXMLTypeMapping();
descriptor.removeMappingForAttributeName("message");
// name of the attribute
mapping.setAttributeName("message");
// IntegrityChecker requires uppercase for oracle
// name of the column
mapping.setFieldName("MESSAGE");
descriptor.addMapping(mapping);
@Entity(name = "XmlMessage")
@Table(name = "XML_MSG")
@Customizer(XmlMessageCustomizer.class)
public class XmlMessage {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "ID")
private long id;
// @Column(columnDefinition = "XMLTYPE")
// private String message;
// ALTER TABLE XML_SYS_MSG drop column message;
// ALTER TABLE XML_SYS_MSG add (message XMLType);
private Document message;
public XmlMessage() {
public long getId() {
return id;
public void setId(final long id) {
this.id = id;
public Document getMessage() {
return message;
public void setMessage(final Document message) {
this.message = message;
Secondly if I turn on the IntegrityChecker it will fail
public class EnableIntegrityChecker implements SessionCustomizer {
@Override
public void customize(final Session session) throws Exception {
session.getIntegrityChecker().checkDatabase();
session.getIntegrityChecker().setShouldCatchExceptions(false);
}Adding:
mapping.getField().setColumnDefinition("XMLTYPE");to the customizer should solve the problem.
--Shaun -
How can I rename the PATH_TABLE table of an index for an XMLType column?
I have a table having a column of type XMLType. Thus, I had created an XMLIndex with an according <tablename>PATHTABLE table.
Now I want to rename the table as well as the associated <tablename>PATHTABLE table.
How can I achieve this? Do I have to rename the XMLIndex as well?
Thank you."ALTER INDEX " + idxName + " PARAMETERS('PATH TABLE " + newTblName + "')";does the trick but I can't achieve renaming the index with
ALTER INDEX " + oldIdxName + " RENAME TO '" + newIdxName + "'";
{code} -
How to create index on a varchar column that represent date?
Hello there,
I have a column in my table that is a VARCHAR2 and represent a datetime like '2010-08-23 19:00:00' I want to create an index on it and with an specific large like '2010-08-23 19' so i can filter per HOURS.
Any one knows the sentence for this?
Thanx in advanceVladimir Zakharychev wrote:
I'd highly recommend you heed the advice given: store dates as DATE, numbers as NUMBER, strings as VARCHAR2. I can't imagine any valid reason for storing dates like that (except the undisputable "because I want it that way.") You are likely to see all sorts of inefficiencies with your current design (it will not sort correctly, for example, because it will sort strings, not dates, and the rules for sorting them are different.) The function-based index you created will only work if your query will use that same exact function you created the index on.Not to mention that there is no way the database can enforce the "date" data to actually be a valid date . . . and there will come a time that the application *will not" enforce it ... -
How to create index on xmltype column
I have a table having only one column xmlcontent (xmltype). This table stores xml data of about 10GB size. I'm using extract value to move the data to staging tables.
How can I create index on xmltype column?
Create index indexname on table (column) doesn't seem to work.
Sample xmlstructure is given below
<Root>
<Type>Insert</Type>
<Date>2006-12-29</Date>
<Source>8</Source>
<id>data</id>
<key_flds>
<fld><id>Key1</id><val>C</val></fld>
<fld><id>Key2</id><val>429672</val></fld>
<fld><id>Key3</id><val>8</val></fld>
</key_flds>
</Root>
I need to do extract value on all tags and move them to corresponding relational tables.Hi, you need to create them using something like this (what I have used and work rather well - if I did not load the xml into an xml table, the processing took about 10 minutes, while the indexed xml table took just a few seconds). statute_xml is the table name and sxmldoc is the xml column/field.
create index desc_idx on statute_xml
(sxmldoc.existsNode('/SimpleTypeCompanion/EnumerationValue/@description'))
create index sid_idx on statute_xml
(sxmldoc.existsNode
('/SimpleTypeCompanion/EnumerationValue/Text')
create index effdate_idx on statute_xml
(sxmldoc.existsNode
('/SimpleTypeCompanion/EnumerationValue/@effectiveDate')
Hope this helps.
Ben -
Index within timestamp column of XML datatype
Team , Thanks for your help in advance !
I'm looking out for some suggestions about creating indexes within XML datatype , Preferably a timestamp . Pasted below sample xml data ..I'm googling it in the interim while some one help me here .
<RingBufferTarget truncated="0" processingTime="0" totalEventsProcessed="2" eventCount="2" droppedCount="0" memoryUsed="1054">
<event name="object_created" package="sqlserver" timestamp="2015-03-09T08:20:17.550Z">
<data name="database_id">
<type name="uint32" package="package0" />
<value>41</value>
</data>
<data name="object_id">
<type name="int32" package="package0" />
<value>933578364</value>
</data>
<data name="object_type">
<type name="object_type" package="sqlserver" />
<value>8277</value>
<text>USRTAB</text>
</data>
<data name="index_id">
<type name="uint32" package="package0" />
<value>0</value>
</data>
<data name="related_object_id">
<type name="int32" package="package0" />
<value>0</value>
</data>
<data name="ddl_phase">
<type name="ddl_opcode" package="sqlserver" />
<value>0</value>
<text>Begin</text>
</data>
<data name="transaction_id">
<type name="int64" package="package0" />
<value>284364642</value>
</data>
<data name="object_name">
<type name="unicode_string" package="package0" />
<value>DUMMY</value>
</data>
<data name="database_name">
<type name="unicode_string" package="package0" />
<value />
</data>
<action name="cpu_id" package="sqlos">
<type name="uint32" package="package0" />
<value>0</value>
</action>
<action name="task_time" package="sqlos">
<type name="uint64" package="package0" />
<value>14322587</value>
</action>
<action name="client_app_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>Microsoft SQL Server Management Studio - Query</value>
</action>
<action name="client_hostname" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>VDDBARY</value>
</action>
<action name="database_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>TEST_R_D</value>
</action>
<action name="nt_username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value />
</action>
<action name="server_instance_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>SQLDEV01</value>
</action>
<action name="server_principal_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>ryelug01</value>
</action>
<action name="session_id" package="sqlserver">
<type name="uint16" package="package0" />
<value>99</value>
</action>
<action name="session_nt_username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value />
</action>
<action name="session_resource_group_id" package="sqlserver">
<type name="uint32" package="package0" />
<value>2</value>
</action>
<action name="sql_text" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>USE TEST_R_d
CREATE TABLE DUMMY
id int not null
)</value>
</action>
<action name="username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>ryelug01</value>
</action>
</event>
<event name="object_created" package="sqlserver" timestamp="2015-03-09T08:20:17.552Z">
<data name="database_id">
<type name="uint32" package="package0" />
<value>41</value>
</data>
<data name="object_id">
<type name="int32" package="package0" />
<value>933578364</value>
</data>
<data name="object_type">
<type name="object_type" package="sqlserver" />
<value>8277</value>
<text>USRTAB</text>
</data>
<data name="index_id">
<type name="uint32" package="package0" />
<value>0</value>
</data>
<data name="related_object_id">
<type name="int32" package="package0" />
<value>0</value>
</data>
<data name="ddl_phase">
<type name="ddl_opcode" package="sqlserver" />
<value>1</value>
<text>Commit</text>
</data>
<data name="transaction_id">
<type name="int64" package="package0" />
<value>284364642</value>
</data>
<data name="object_name">
<type name="unicode_string" package="package0" />
<value>DUMMY</value>
</data>
<data name="database_name">
<type name="unicode_string" package="package0" />
<value />
</data>
<action name="cpu_id" package="sqlos">
<type name="uint32" package="package0" />
<value>0</value>
</action>
<action name="task_time" package="sqlos">
<type name="uint64" package="package0" />
<value>14322583</value>
</action>
<action name="client_app_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>Microsoft SQL Server Management Studio - Query</value>
</action>
<action name="client_hostname" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>VDDBARY</value>
</action>
<action name="database_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>TEST_R_D</value>
</action>
<action name="nt_username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value />
</action>
<action name="server_instance_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>SQLDEV01</value>
</action>
<action name="server_principal_name" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>ryelug01</value>
</action>
<action name="session_id" package="sqlserver">
<type name="uint16" package="package0" />
<value>99</value>
</action>
<action name="session_nt_username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value />
</action>
<action name="session_resource_group_id" package="sqlserver">
<type name="uint32" package="package0" />
<value>2</value>
</action>
<action name="sql_text" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>USE TEST_R_d
CREATE TABLE DUMMY
id int not null
)</value>
</action>
<action name="username" package="sqlserver">
<type name="unicode_string" package="package0" />
<value>ryelug01</value>
</action>
</event>
</RingBufferTarget>
Rajkumar YeluguThanks for the link Visakh !
It helps me getting started , I applied few tips on to my ongoing stored proc ( Below ) but not a great improvement though , Thanks for your further assistance .
CREATE TABLE #XML_Hold
ID INT NOT NULL IDENTITY(1,1) PRIMARY KEY , -- PK necessity for Indexing on XML Col
BufferXml XML
INSERT INTO #XML_Hold (BufferXml)
SELECT
CAST(target_data AS XML) AS TargetData --BufferXml
FROM sys.dm_xe_session_targets xet
INNER JOIN sys.dm_xe_sessions xes
ON xes.address = xet.event_session_address
WHERE xes.name = 'Capture DDL Schema Changes'
--RETURN
SELECT GETDATE() AS GETDATE_1
CREATE PRIMARY XML INDEX [IX_XML_Hold] ON #XML_Hold(BufferXml) -- Ryelugu 03/09/2015 - Primary Index
SELECT GETDATE() AS GETDATE_2
--create secondary xml value index
CREATE XML INDEX [IX_XML_Hold_values] ON #XML_Hold(BufferXml)
USING XML INDEX [IX_XML_Hold]
FOR VALUE
SELECT GETDATE() AS GETDATE_3
SELECT
p.q.value('@name[1]','varchar(100)') AS eventname,
p.q.value('@timestamp[1]','datetime') AS timestampvalue,
p.q.value('(./data[@name="object_name"]/value)[1]','varchar(100)') AS objectname,
p.q.value('(./data[@name="object_type"]/text)[1]','varchar(100)') AS ObjectType,
p.q.value('(./action[@name="database_name"]/value)[1]','varchar(100)') AS databasename,
p.q.value('(./data[@name="ddl_phase"]/text)[1]','varchar(100)') AS ddl_phase,
p.q.value('(./action[@name="client_app_name"]/value)[1]','varchar(100)') AS clientappname,
p.q.value('(./action[@name="client_hostname"]/value)[1]','varchar(100)') AS clienthostname,
p.q.value('(./action[@name="server_instance_name"]/value)[1]','varchar(100)') AS server_instance_name,
p.q.value('(./action[@name="nt_username"]/value)[1]','varchar(100)') AS nt_username,
p.q.value('(./action[@name="server_principal_name"]/value)[1]','varchar(100)') AS serverprincipalname,
p.q.value('(./action[@name="sql_text"]/value)[1]','Nvarchar(max)') AS sqltext
FROM #XML_Hold
CROSS APPLY BufferXml.nodes('/RingBufferTarget/event')p(q)
WHERE -- Ryelugu 03/05/2015 -
p.q.value('@timestamp[1]','datetime') >= ISNULL(@Prev_Insertion_time ,p.q.value('@timestamp[1]','datetime'))
AND p.q.value('(./data[@name="ddl_phase"]/text)[1]','varchar(100)') ='Commit'
AND p.q.value('(./data[@name="object_type"]/text)[1]','varchar(100)') <> 'STATISTICS'
AND p.q.value('(./data[@name="object_name"]/value)[1]','varchar(100)') NOT LIKE '%#%'
It appears that filtering and selecting from #XML_Hold is TIME taking .
Rajkumar Yelugu -
XMLType column based on XML Schema: several questions
Hi,
I've a table on an oracle db version 10.1.0.4 where I stage the xml files containing orders created on a third party's system using BizTalk.
Although the storage I opted for is based on an XML Schema, defined by this third-party, I am facing big perfomance issues with files bigger than a few hundreds of kBs.
For instance, a 32Mb file takes more than 2 hours to be processed.
Now, after reading other threads in this forum and the documentation, my understanding of the problem is that the whole issue is with the correct indexing of the nested tables.
Here is my current XML Schema definition:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xs:include schemaLocation="private/Types.xsd"/>
<xs:element name="PickData">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="ProdRun">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="xs:int"/>
<xs:element name="Date" type="string8"/>
<xs:element name="Final" type="xs:int"/>
<xs:element name="PickWave" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="string10"/>
<xs:element name="ProdLine" type="string2"/>
<xs:element name="TourSeq" type="xs:int"/>
<xs:element name="Tour" type="string20"/>
<xs:element name="Customer" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Seq" type="string20"/>
<xs:element name="Cust" type="string10"/>
<xs:element name="Mod" type="string30"/>
<xs:element name="Tod" type="string30"/>
<xs:element name="InvOrder" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="string20"/>
<xs:element name="Item" type="string20"/>
<xs:element name="Qty" type="xs:int"/>
<xs:element name="Priority" type="xs:int"/>
<xs:element name="Reordering" type="xs:int"/>
<xs:element name="DelDate" type="string8"/>
<xs:element name="HlOrder" type="string20"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="InvOrderKey">
<xs:selector xpath="InvOrder"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="CustomerKey">
<xs:selector xpath="Customer"/>
<xs:field xpath="Seq"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="PickWaveKey">
<xs:selector xpath="PickWave"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="ProdRunKey">
<xs:selector xpath="ProdRun"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Here is the included sub-schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="string2">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="2"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string5">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string6">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="6"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string8">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string15">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string20">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string30">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string40">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string50">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string250">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="250"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
The statement for creating my table is
CREATE TABLE "XML_ORDERS"
("ID" NUMBER(7,0) NOT NULL ENABLE,
"XMLFILE" "SYS"."XMLTYPE" ,
"INSERTED" DATE DEFAULT sysdate,
CONSTRAINT "XML_ORDERS_PK" PRIMARY KEY ("ID") USING INDEX ENABLE
) XMLTYPE COLUMN XMLFILE STORE AS OBJECT RELATIONAL
XMLSCHEMA "private/PickData.xsd" ELEMENT "PickData"
Here is a simple instance document:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<PickData xsi:noNamespaceSchemaLocation="private/PickData.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ProdRun>
<Nr>5</Nr>
<Date>15112005</Date>
<Final>1</Final>
<PickWave>
<Nr>IPW0000017</Nr>
<ProdLine>01</ProdLine>
<TourSeq>1</TourSeq>
<Tour>00000043_078</Tour>
<Customer>
<Seq>5</Seq>
<Cust>100000006</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000457</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000742</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000459</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000742</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>6</Seq>
<Cust>100000013</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000461</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000743</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000463</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000743</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>2</Seq>
<Cust>100000114</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000465</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000744</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000467</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000744</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>3</Seq>
<Cust>100000140</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000469</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000745</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000471</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000745</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>7</Seq>
<Cust>100000143</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000473</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000746</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000475</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000746</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>8</Seq>
<Cust>100000145</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000477</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000747</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000479</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000747</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>9</Seq>
<Cust>100000146</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000481</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000748</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000483</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000748</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>4</Seq>
<Cust>100000147</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000485</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000750</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000487</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000750</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>10</Seq>
<Cust>100000148</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000489</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000751</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000491</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000751</HlOrder>
</InvOrder>
</Customer>
</PickWave>
</ProdRun>
</PickData>
When I registered the XMLSchema, the following types and tables were automatically created and you can see the hierarchy below:
(by the way, I could not find any xdb_utilities.printNestedTables mentioned elsewhere)
XML_ORDERS
|_PickData381_T
|___ProdRun382_T
|_____PickWave388_COLL
|_______PickWave383_T
|_________Customer387_COLL
|___________Customer384_T
|_____________InvOrder386_COLL
These objects are then used in the following nested tables:
TABLE_NAME TABLE_TYPE_NAME PARENT_TABLE_NAME PARENT_TABLE_COLUMN
SYS_NTaK/5zar5S0WitSsgu6OKPQ== PickWave388_COLL PickData389_TAB "XMLDATA"."ProdRun"."PickWave"
SYS_NTf6QvwVm8SFKz+K/YYWq+WQ== Item408_COLL ProdData409_TAB "XMLDATA"."Item"
SYS_NTtu05ilrRQqmuEN4k+07VDA== Customer402_COLL OutboundParty403_TAB "XMLDATA"."Customer"
SYS_NTK6fhWq5uTJ+vKcgBpNm1Fg== InvOrder386_COLL SYS_NTIIzv7bkXQSSS43igtfi5eg== InvOrder
SYS_NTIIzv7bkXQSSS43igtfi5eg== Customer387_COLL SYS_NTaK/5zar5S0WitSsgu6OKPQ== Customer
I enabled sql tracing and I got the following TKPROF output
INSERT INTO IMP_ORDERS (PICK_INVORDERNR, PICK_ITEM, PICK_QTY, PICK_PRIORITY,
PICK_REORDERING, PICK_HLORDER, PICK_DELDATE, PICK_CUST, PICK_MOD, PICK_TOD,
PICK_SEQ, PICK_PICKWAVENR, PICK_PICKWAVEPRODLINE, PICK_PICKWAVETOUR,
PICK_PICKWAVETOURSEQ, PICK_ORDKEY, PICK_RUNKEY) SELECT INVORDERNR, ITEM,
QTY, PRIORITY, REORDERING, HLORDER, DELDATE, CUST, MOD, TOD, SEQ,
PICKWAVENR, PICKWAVEPRODLINE, PICKWAVETOUR, PICKWAVETOURSEQ, ROWNUM AS
PICK_ORDKEY, PRODRUNID FROM (SELECT /*+ cardinality(g 15)*/
EXTRACTVALUE(VALUE(G), '/InvOrder/Nr') AS INVORDERNR, EXTRACTVALUE(VALUE(G),
'/InvOrder/Item') AS ITEM, EXTRACTVALUE(VALUE(G), '/InvOrder/Qty') AS QTY,
EXTRACTVALUE(VALUE(G), '/InvOrder/Priority') AS PRIORITY,
EXTRACTVALUE(VALUE(G), '/InvOrder/Reordering') AS REORDERING,
EXTRACTVALUE(VALUE(G), '/InvOrder/HlOrder') AS HLORDER,
TO_DATE(EXTRACTVALUE(VALUE(G), '/InvOrder/DelDate'),'DDMMYYYY') AS DELDATE,
F.CUST, F.MOD, F.TOD, F.SEQ, F.PICKWAVENR, F.PICKWAVEPRODLINE,
F.PICKWAVETOUR, F.PICKWAVETOURSEQ, F.PRODRUNNR, F.PRODRUNDATE,
F.PRODRUNFINAL, F.PRODRUNID FROM (SELECT /*+ cardinality(e 60)*/VALUE(E) AS
CUSTOMERNODE, EXTRACTVALUE(VALUE(E), '/Customer/Cust') AS CUST,
EXTRACTVALUE(VALUE(E), '/Customer/Mod') AS MOD, EXTRACTVALUE(VALUE(E),
'/Customer/Tod') AS TOD, TO_NUMBER(EXTRACTVALUE(VALUE(E), '/Customer/Seq'))
AS SEQ, D.PICKWAVENR, D.PICKWAVEPRODLINE, D.PICKWAVETOUR, D.PICKWAVETOURSEQ,
D.PRODRUNNR, D.PRODRUNDATE, D.PRODRUNFINAL, D.PRODRUNID FROM (SELECT /*+
cardinality(c 100)*/VALUE(C) AS PICKWAVENODE, EXTRACTVALUE(VALUE(C),
'/PickWave/Nr') AS PICKWAVENR, TO_NUMBER(EXTRACTVALUE(VALUE(C),
'/PickWave/ProdLine')) AS PICKWAVEPRODLINE, EXTRACTVALUE(VALUE(C),
'/PickWave/Tour') AS PICKWAVETOUR, TO_NUMBER(EXTRACTVALUE(VALUE(C),
'/PickWave/TourSeq')) AS PICKWAVETOURSEQ, A.PRODRUNNR, A.PRODRUNDATE,
A.PRODRUNFINAL, A.PRODRUNID FROM (SELECT /*+ cardinality(b 1)*/VALUE(B) AS
PRODRUNNODE, EXTRACTVALUE(VALUE(B), '/ProdRun/Nr') AS PRODRUNNR,
TO_DATE(EXTRACTVALUE(VALUE(B), '/ProdRun/Date'),'DDMMYYYY') AS PRODRUNDATE,
EXTRACTVALUE(VALUE(B), '/ProdRun/Final') AS PRODRUNFINAL, X.ID PRODRUNID
FROM XML_ORDERS X, TABLE(XMLSEQUENCE(EXTRACT(X.XMLFILE,'/PickData/ProdRun'))
) B WHERE X.ID = :B1 ) A, TABLE(XMLSEQUENCE(EXTRACT(A.PRODRUNNODE,
'/ProdRun/PickWave'))) C ) D, TABLE(XMLSEQUENCE(EXTRACT(D.PICKWAVENODE,
'/PickWave/Customer'))) E ) F, TABLE(XMLSEQUENCE(EXTRACT(F.CUSTOMERNODE,
'/Customer/InvOrder'))) G ORDER BY PICKWAVEPRODLINE, PICKWAVETOURSEQ,
PICKWAVENR, SEQ )
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 4324.09 9994.65 0 57193 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 4324.09 9994.65 0 57193 0 0
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 68 (recursive depth: 1)
Rows Row Source Operation
0 COUNT (cr=0 pr=0 pw=0 time=180 us)
0 VIEW (cr=0 pr=0 pw=0 time=166 us)
0 SORT ORDER BY (cr=0 pr=0 pw=0 time=152 us)
40866 NESTED LOOPS (cr=54973 pr=0 pw=0 time=31065606 us)
1363 NESTED LOOPS (cr=54937 pr=0 pw=0 time=11037183 us)
1 NESTED LOOPS (cr=54889 pr=0 pw=0 time=10145883 us)
1 NESTED LOOPS (cr=54841 pr=0 pw=0 time=9799012 us)
1 TABLE ACCESS BY INDEX ROWID XML_ORDERS (cr=2 pr=0 pw=0 time=222 us)
1 INDEX UNIQUE SCAN XML_ORDERS_PK (cr=1 pr=0 pw=0 time=126 us)(object id 58551)
1 COLLECTION ITERATOR PICKLER FETCH (cr=54839 pr=0 pw=0 time=9798748 us)
1 COLLECTION ITERATOR PICKLER FETCH (cr=48 pr=0 pw=0 time=346818 us)
1363 COLLECTION ITERATOR PICKLER FETCH (cr=48 pr=0 pw=0 time=870830 us)
40866 COLLECTION ITERATOR PICKLER FETCH (cr=36 pr=0 pw=0 time=18739302 us)
Note that I cancelled this operation before it was over so I imagine that these figures refer to the statistics as of the time when the operation was interrupted.
So, here are finally my questions.
In order to create the constraints on the nested tables as shown in other threads, do I need to drop the existing xml_orders table and ancillary object types and recreate them or is there a way to add such constraints using the existing system generated object names?
Secondly, the xml_orders table may contain severale documents, not just one and his current primary key is the column ID. So, in order to uniquely identify the deepest element in the xml document, I need first to select the relevant document by means of the id column.
Would it be better to create the indexes containing this id column together with the nested_table_id and array_index?
Thanks for you help.
Flavio
PS: I wrote a 10 lines xsl transformation that I passed on to Saxon together with the 32Mb file. It took less than 1 minute to produce a flat file that was loaded almost instantly by SQL*Loader. So, what I am looking for is a procedure loading this stuff in less than 2 minutes or possibly less.Does the following help
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:53 2005
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/GetaxTypes.xsd',
old 5: bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
new 5: bfilename(USER,'GetaxTypes.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 => 'private/GetaxTypes.xsd',
old 5: schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
new 5: schemaDoc => xdbURIType('/home/OTNTEST/xsd/GetaxTypes.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.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:55 2005
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/PickData.xsd',
old 5: bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
new 5: bfilename(USER,'PickData.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 => 'private/PickData.xsd',
old 5: schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
new 5: schemaDoc => xdbURIType('/home/OTNTEST/xsd/PickData.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.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:58 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool createTable.log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> CREATE TABLE "XML_ORDERS"
2 ("ID" NUMBER(7,0) NOT NULL ENABLE,
3 "XMLFILE" "SYS"."XMLTYPE" ,
4 "INSERTED" DATE DEFAULT sysdate,
5 CONSTRAINT "XML_ORDERS_PK" PRIMARY KEY ("ID") USING INDEX ENABLE
6 ) XMLTYPE COLUMN XMLFILE STORE AS OBJECT RELATIONAL
7 XMLSCHEMA "private/PickData.xsd"
8 ELEMENT "PickData"
9 VARRAY XMLFILE."XMLDATA"."ProdRun"."PickWave" STORE AS TABLE PickWave_TAB
10 (
11 ( primary key (nested_table_id, array_index)
12 ) organization index overflow
13 VARRAY "Customer" STORE AS TABLE Customer_TAB
14 (
15 (primary key (nested_table_id, array_index)
16 ) organization index overflow
17 VARRAY "InvOrder" STORE AS TABLE InvOrder_TAB
18 (
19 (primary key (nested_table_id, array_index)
20 ) organization index overflow
21 )
22 )
23 )
24 /
Table created.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:59 2005
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 XML_ORDERS (ID, XMLFILE) values (&4, xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
2 /
old 1: insert into XML_ORDERS (ID, XMLFILE) values (&4, xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
new 1: insert into XML_ORDERS (ID, XMLFILE) values (10, xmltype(bfilename(USER,'testcase.xml'),nls_charset_id('AL32UT
8')))
1 row created.
Elapsed: 00:00:00.11
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:59 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool testcase.log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> set long 10000
SQL> set pages 0 lines 140
SQL> --
SQL> -- Testcase code here
SQL> --
SQL> set autotrace on explain
SQL> --
SQL> create or replace view PROD_RUN_VIEW
2 (
3 PRODRUNNODE,
4 PRODRUNNR,
5 PRODRUNDATE,
6 PRODRUNID,
7 PRODRUNFINAL
8 )
9 as
10 select EXTRACT(XMLFILE,'/PickData/ProdRun'),
11 EXTRACTVALUE(XMLFILE , '/PickData/ProdRun/Nr'),
12 TO_DATE(EXTRACTVALUE(XMLFILE, '/PickData/ProdRun/Date'),'DDMMYYYY'),
13 ID,
14 EXTRACTVALUE(XMLFILE,'/PickData/ProdRun/Final')
15 from XML_ORDERS
16 /
View created.
Elapsed: 00:00:00.09
SQL> create or replace view PICK_WAVE_VIEW
2 (
3 PICKWAVENODE,
4 PICKWAVENR,
5 PICKWAVEPRODLINE,
6 PICKWAVETOUR,
7 PICKWAVETOURSEQ,
8 PRODRUNNR,
9 PRODRUNDATE,
10 PRODRUNID,
11 PRODRUNFINAL
12 )
13 as
14 select value(PW),
15 extractValue(value(PW),'/PickWave/Nr'),
16 TO_NUMBER(EXTRACTVALUE(value(PW),'/PickWave/ProdLine')),
17 extractValue(value(PW),'/PickWave/Tour'),
18 TO_NUMBER(extractValue(value(PW),'/PickWave/TourSeq')),
19 PRODRUNNR,
20 PRODRUNDATE,
21 PRODRUNID,
22 PRODRUNFINAL
23 FROM PROD_RUN_VIEW, table(xmlsequence(extract(PRODRUNNODE,'/ProdRun/PickWave'))) PW
24 /
View created.
Elapsed: 00:00:00.09
SQL> create or replace view CUSTOMER_VIEW
2 (
3 CUSTOMERNODE,
4 CUST,
5 MOD,
6 TOD,
7 SEQ,
8 PICKWAVENR,
9 PICKWAVEPRODLINE,
10 PICKWAVETOUR,
11 PICKWAVETOURSEQ,
12 PRODRUNNR,
13 PRODRUNDATE,
14 PRODRUNFINAL,
15 PRODRUNID
16 )
17 as
18 select value(CUST),
19 EXTRACTVALUE(VALUE(CUST), '/Customer/Cust'),
20 EXTRACTVALUE(VALUE(CUST), '/Customer/Mod'),
21 EXTRACTVALUE(VALUE(CUST), '/Customer/Tod'),
22 TO_NUMBER(EXTRACTVALUE(VALUE(CUST), '/Customer/Seq')),
23 PICKWAVENR,
24 PICKWAVEPRODLINE,
25 PICKWAVETOUR,
26 PICKWAVETOURSEQ,
27 PRODRUNNR,
28 PRODRUNDATE,
29 PRODRUNFINAL,
30 PRODRUNID
31 from PICK_WAVE_VIEW, table(xmlsequence(extract(PICKWAVENODE,'/PickWave/Customer'))) CUST
32 /
View created.
Elapsed: 00:00:00.10
SQL>
SQL> create or replace view INVOICE_ORDER_VIEW
2 (
3 INVORDERNR,
4 ITEM,
5 QTY,
6 PRIORITY,
7 REORDERING,
8 HLORDER,
9 DELDATE,
10 CUST,
11 MOD,
12 TOD,
13 SEQ,
14 PICKWAVENR,
15 PICKWAVEPRODLINE,
16 PICKWAVETOUR,
17 PICKWAVETOURSEQ,
18 PRODRUNNR,
19 PRODRUNDATE,
20 PRODRUNFINAL,
21 PRODRUNID
22 )
23 as
24 SELECT EXTRACTVALUE(VALUE(INV), '/InvOrder/Nr'),
25 EXTRACTVALUE(VALUE(INV), '/InvOrder/Item'),
26 EXTRACTVALUE(VALUE(INV), '/InvOrder/Qty'),
27 EXTRACTVALUE(VALUE(INV), '/InvOrder/Priority'),
28 EXTRACTVALUE(VALUE(INV), '/InvOrder/Reordering'),
29 EXTRACTVALUE(VALUE(INV), '/InvOrder/HlOrder'),
30 TO_DATE(EXTRACTVALUE(VALUE(INV), '/InvOrder/DelDate'),'DDMMYYYY'),
31 CUST,
32 MOD,
33 TOD,
34 SEQ,
35 PICKWAVENR,
36 PICKWAVEPRODLINE,
37 PICKWAVETOUR,
38 PICKWAVETOURSEQ,
39 PRODRUNNR,
40 PRODRUNDATE,
41 PRODRUNFINAL,
42 PRODRUNID
43 FROM CUSTOMER_VIEW, table(xmlsequence(extract(CUSTOMERNODE,'Customer/InvOrder'))) INV
44 /
View created.
Elapsed: 00:00:00.13
SQL> select * from INVOICE_ORDER_VIEW
2 /
IIO0000461 100000036 20 1 0 CSO000743 15-NOV-05 100000013
FO DDU 6 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000463 100000045 20 1 0 CSO000743 15-NOV-05 100000013
FO DDU 6 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000473 100000036 20 1 0 CSO000746 15-NOV-05 100000143
FO DDU 7 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000475 100000045 20 1 0 CSO000746 15-NOV-05 100000143
FO DDU 7 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000469 100000036 20 1 0 CSO000745 15-NOV-05 100000140
FO DDU 3 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000471 100000045 20 1 0 CSO000745 15-NOV-05 100000140
FO DDU 3 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000489 100000036 20 0 0 CSO000751 15-NOV-05 100000148
FO DDU 10 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000491 100000045 20 1 0 CSO000751 15-NOV-05 100000148
FO DDU 10 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000481 100000036 20 0 0 CSO000748 15-NOV-05 100000146
FO DDU 9 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000483 100000045 20 1 0 CSO000748 15-NOV-05 100000146
FO DDU 9 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000485 100000036 20 0 0 CSO000750 15-NOV-05 100000147
FO DDU 4 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000487 100000045 20 1 0 CSO000750 15-NOV-05 100000147
FO DDU 4 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000457 100000036 20 1 0 CSO000742 15-NOV-05 100000006
FO DDU 5 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000459 100000045 20 1 0 CSO000742 15-NOV-05 100000006
FO DDU 5 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000477 100000036 20 1 0 CSO000747 15-NOV-05 100000145
FO DDU 8 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000479 100000045 20 1 0 CSO000747 15-NOV-05 100000145
FO DDU 8 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000465 100000036 20 1 0 CSO000744 15-NOV-05 100000114
FO DDU 2 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000467 100000045 20 1 0 CSO000744 15-NOV-05 100000114
FO DDU 2 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
18 rows selected.
Elapsed: 00:00:00.22
Execution Plan
Plan hash value: 1730223965
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 18 | 10278 | 877 (0)| 00:00:11 |
| 1 | NESTED LOOPS | | 18 | 10278 | 877 (0)| 00:00:11 |
| 2 | NESTED LOOPS | | 18 | 8424 | 841 (0)| 00:00:11 |
| 3 | MERGE JOIN CARTESIAN | | 18 | 4680 | 805 (0)| 00:00:10 |
| 4 | TABLE ACCESS FULL | XML_ORDERS | 1 | 67 | 3 (0)| 00:00:01 |
| 5 | BUFFER SORT | | 18 | 3474 | 802 (0)| 00:00:10 |
| 6 | INDEX FAST FULL SCAN| SYS_IOT_TOP_64187 | 18 | 3474 | 802 (0)| 00:00:10 |
|* 7 | INDEX UNIQUE SCAN | SYS_IOT_TOP_64185 | 1 | 208 | 2 (0)| 00:00:01 |
|* 8 | INDEX RANGE SCAN | SYS_C008783 | 1 | | 0 (0)| 00:00:01 |
|* 9 | INDEX UNIQUE SCAN | SYS_IOT_TOP_64183 | 1 | 103 | 2 (0)| 00:00:01 |
|* 10 | INDEX RANGE SCAN | SYS_C008785 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
7 - access("NESTED_TABLE_ID"="CUSTOMER_TAB"."SYS_NC0000800009$")
8 - access("NESTED_TABLE_ID"="CUSTOMER_TAB"."SYS_NC0000800009$")
9 - access("NESTED_TABLE_ID"="PICKWAVE_TAB"."SYS_NC0000800009$")
filter("NESTED_TABLE_ID"="XML_ORDERS"."SYS_NC0001000011$")
10 - access("NESTED_TABLE_ID"="PICKWAVE_TAB"."SYS_NC0000800009$")
Note
- dynamic sampling used for this statement
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
C:\oracle\xdb\otn\347125>You were sequencing the ProdRun node, which is a mistake. Only nodes which occur multiple times should be sequenced... -
OracleDataReader allocation using extractvalue() on XMLType column
I am accessing an element within an XMLType column in a select statement using the extractvalue SQL function.
Select ExtractValue(column_name,'//Text') from table_name
I noticed that the RowSize for the command used to execute the select is unusually large (~24K). I have narrowed the space allocation issue down to the extractvalue() column, which is about 8k per instance of extractvalue() in the select statement. Since the fetch size if 64K, I am seeing a lot of calls to opsDacRead (DB round trips?) in the ODP.NET log, probably due to the fact that only 3 rows are being returned in each call to opsDacRead.
My question is: How does ODP.NET determine the amount of space allocated within the reader's buffer for such a column? The element I am trying to extract is defined in the xml schema as 'xs:string' and is never more than 40 characters or so.Mark,
Thanks for the response.
Yes, I tried increasing FetchSize. Unfortunately, under heavy load, I experienced long execution/wait times within the first and last calls to opsDacRead() while walking the reader. I suspect that was due to allocation and clean-up.
However, I did find out why the buffer size was so large. If the xml schema does not contain length restrictions on string/text elements via the maxLength option, Oracle defines the underlying field in the data type created for the schema as VARCHAR2(4000).
I'm pretty sure that adding a maxLength restriction to the string element in the xml schema will reduce the size of the data type's field and in turn reduce the size of the Reader's buffer, but I haven't had a chance to test it.
Thanks again,
-Jeff -
Create Index on another schema table stored in my table
Hi,
I want to create index on a table column which is in another schema from my schema and the index to be stored in my schema.
ex: current user 'hr'
sql>create index idx1 on scott.emp(eno);
Does the above query works??
thanks,
SriWhy cant you give a try?
Are you getting any error message?
See below..
SQL> show user
USER is "SCOTT"
SQL> grant select on emp to hr;
Grant succeeded.
SQL> conn
Enter user-name: hr@***
Enter password:
Connected.
SQL> show user
USER is "HR"
SQL> create index ndx on scott.emp(sal);
create index ndx on scott.emp(sal)
ERROR at line 1:
ORA-01031: insufficient privileges
SQL> conn
Enter user-name: system@*******
Enter password:
Connected.
SQL> create index ndx on scott.emp(sal);
Index created.
SQL> drop index ndx;
Index dropped.
SQL> grant create any index to hr;
Grant succeeded.
SQL> conn
Enter user-name: hr@*******
Enter password:
Connected.
SQL> create index ndx on scott.emp(sal);
Index created.Edited by: jeneesh on Oct 8, 2012 3:53 PM -
How to create index on XMLType column extension?
I have an XMLType column named "info" whose corresponding global element has a complexType "InfoType" in namespace "http://example.org/ord". The "InfoType" complexType is extended in two namespaces, "http://example.org/info/zipcode" and "http://example.org/info/street". How do I create a unique index using an "InfoType" element contributed from one of the extension namespaces?
I have included below a SQL script that completely describes the problem.
Thanks in advance for your assistance?
- Ron
BEGIN
DBMS_XMLSCHEMA.registerSchema(
'chapter04prod.xsd',
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://example.org/prod"
targetNamespace="http://example.org/prod"
elementFormDefault="unqualified">
<xsd:complexType name="ItemsType">
<xsd:sequence>
<xsd:element name="product" type="ProductType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ProductType">
<xsd:sequence>
<xsd:element name="number" type="xsd:integer"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="size" type="SizeType"/>
<xsd:element name="color" type="ColorType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SizeType">
<xsd:simpleContent>
<xsd:extension base="xsd:integer">
<xsd:attribute name="system" type="xsd:string"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="ColorType">
<xsd:attribute name="value" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>',
TRUE,
TRUE,
FALSE,
FALSE);
END;
BEGIN
DBMS_XMLSCHEMA.registerSchema(
'chapter04ord1.xsd',
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.org/ord"
xmlns="http://example.org/ord"
xmlns:prod="http://example.org/prod"
elementFormDefault="qualified">
<xsd:import namespace="http://example.org/prod"
schemaLocation="chapter04prod.xsd"/>
<xsd:simpleType name="OrderNumType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:complexType name="InfoType"/>
<xsd:complexType name="CustomerType">
<xsd:all>
<xsd:element name="name" type="CustNameType"/>
<xsd:element name="number" type="xsd:integer"/>
<xsd:element name="info" type="InfoType" form="unqualified"/>
</xsd:all>
</xsd:complexType>
<xsd:simpleType name="CustNameType">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:element name="order" type="OrderType"/>
<xsd:element name="customer" type="CustomerType"/>
<xsd:complexType name="OrderType">
<xsd:sequence>
<xsd:element name="number" type="OrderNumType"/>
<xsd:element name="customer" type="CustomerType"
maxOccurs="unbounded"/>
<xsd:element name="items" type="prod:ItemsType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>',
TRUE,
TRUE,
FALSE,
FALSE);
END;
BEGIN
DBMS_XMLSCHEMA.registerSchema(
'chapter04infozipcode.xsd',
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ord="http://example.org/ord"
xmlns="http://example.org/info/zipcode"
targetNamespace="http://example.org/info/zipcode"
elementFormDefault="unqualified">
<xsd:import namespace="http://example.org/ord"
schemaLocation="chapter04ord1.xsd"/>
<xsd:complexType name="InfoType">
<xsd:complexContent>
<xsd:extension base="ord:InfoType">
<xsd:sequence>
<xsd:element name="zipcode" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>',
TRUE,
TRUE,
FALSE,
FALSE);
END;
BEGIN
DBMS_XMLSCHEMA.registerSchema(
'chapter04infostreet.xsd',
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ord="http://example.org/ord"
xmlns="http://example.org/info/street"
targetNamespace="http://example.org/info/street"
elementFormDefault="unqualified">
<xsd:import namespace="http://example.org/ord"
schemaLocation="chapter04ord1.xsd"/>
<xsd:complexType name="InfoType">
<xsd:complexContent>
<xsd:extension base="ord:InfoType">
<xsd:sequence>
<xsd:element name="street" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>',
TRUE,
TRUE,
FALSE,
FALSE);
END;
BEGIN
DBMS_XMLSCHEMA.registerSchema(
'chapter04nonamespace.xsd',
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ord="http://example.org/ord">
<xsd:import namespace="http://example.org/ord"
schemaLocation="chapter04ord1.xsd"/>
<xsd:element name="info" type="ord:InfoType">
</xsd:schema>',
TRUE,
TRUE,
FALSE,
FALSE);
END;
CREATE TABLE customer (
name VARCHAR(64),
number INTEGER,
info XMLTYPE)
XMLType info STORE AS OBJECT RELATIONAL
XMLSCHEMA "chapter04nonamespace.xsd"
ELEMENT "info";
INSERT INTO customer (name, number, info)
VALUES ('George Jones', 1,
XMLType(
'<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:street="http://example.org/info/zipcode"
xsi:type="zipcode:InfoType">
<zipcode>28877</zipcode>
</info>');
INSERT INTO customer (name, number, info)
VALUES ('Jim Jones', 2,
XMLType(
'<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:street="http://example.org/info/street"
xsi:type="street:InfoType">
<street>3456 Autumn Lane</street>
</info>');
SELECT name,
extractValue(info, '/info/street')
FROM customer
WHERE extractValue(info, '/info/street/text()') LIKE '3456%';
-- How does one create a unique index as follows?
CREATE UNIQUE INDEX customer_infostreet ON customer (??????);
-- The following insert should fail with unique index violation!
INSERT INTO customer (name, number, info)
VALUES ('Jerry Jones', 3,
XMLType(
'<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:street="http://example.org/info/street"
xsi:type="street:InfoType">
<street>3456 Autumn Lane</street>
</info>');Ron
Glad you found a solution.. However a more efficient solution is show below
SQL> connect sys/ as sysdba
Enter password:
Connected.
SQL> set define on
SQL> --
SQL> define USERNAME = OTNTEST
SQL> --
SQL> def PASSWORD = OTNTEST
SQL> --
SQL> def USER_TABLESPACE = USERS
SQL> --
SQL> def TEMP_TABLESPACE = TEMP
SQL> --
SQL> drop user &USERNAME cascade
2 /
old 1: drop user &USERNAME cascade
new 1: drop user OTNTEST cascade
User dropped.
SQL> grant connect, resource to &USERNAME identified by &PASSWORD
2 /
old 1: grant connect, resource to &USERNAME identified by &PASSWORD
new 1: grant connect, resource to OTNTEST identified by OTNTEST
Grant succeeded.
SQL> grant create any directory, drop any directory to &USERNAME
2 /
old 1: grant create any directory, drop any directory to &USERNAME
new 1: grant create any directory, drop any directory to OTNTEST
Grant succeeded.
SQL> grant alter session, create view to &USERNAME
2 /
old 1: grant alter session, create view to &USERNAME
new 1: grant alter session, create view to OTNTEST
Grant succeeded.
SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
2 /
old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
new 1: alter user OTNTEST default tablespace USERS temporary tablespace TEMP
User altered.
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> alter session set events ='19027 trace name context forever, level 0x800'
2 /
Session altered.
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 'chapter04prod.xsd',
4 '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://example.org/prod" targetNamespa
fault="unqualified">
5 <xsd:complexType name="ItemsType">
6 <xsd:sequence>
7 <xsd:element name="product" type="ProductType"/>
8 </xsd:sequence>
9 </xsd:complexType>
10 <xsd:complexType name="ProductType">
11 <xsd:sequence>
12 <xsd:element name="num" type="xsd:integer"/>
13 <xsd:element name="name" type="xsd:string"/>
14 <xsd:element name="size" type="SizeType"/>
15 <xsd:element name="color" type="ColorType"/>
16 </xsd:sequence>
17 </xsd:complexType>
18 <xsd:complexType name="SizeType">
19 <xsd:simpleContent>
20 <xsd:extension base="xsd:integer">
21 <xsd:attribute name="system" type="xsd:string"/>
22 </xsd:extension>
23 </xsd:simpleContent>
24 </xsd:complexType>
25 <xsd:complexType name="ColorType">
26 <xsd:attribute name="value" type="xsd:string"/>
27 </xsd:complexType>
28 </xsd:schema>',
29 TRUE, TRUE, FALSE, FALSE);
30 END;
31 /
PL/SQL procedure successfully completed.
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 'chapter04ord1.xsd',
4 '<xsd:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns
://example.org/prod" targetNamespace="http://example.org/ord" elementFormDefault="qualified">
5 <xsd:import namespace="http://example.org/prod" schemaLocation="chapter04prod.xsd"/>
6 <xsd:simpleType name="OrderNumType">
7 <xsd:restriction base="xsd:string"/>
8 </xsd:simpleType>
9 <xsd:complexType name="InfoType" xdb:SQLType="INFO_TYPE_T"/>
10 <xsd:complexType name="CustomerType">
11 <xsd:all>
12 <xsd:element name="name" type="CustNameType"/>
13 <xsd:element name="num" type="xsd:integer"/>
14 <xsd:element name="info" type="InfoType" minOccurs="1" form="unqualified"/>
15 </xsd:all>
16 </xsd:complexType>
17 <xsd:simpleType name="CustNameType">
18 <xsd:restriction base="xsd:string"/>
19 </xsd:simpleType>
20 <xsd:element name="customers" type="CustomersType"/>
21 <xsd:complexType name="CustomersType">
22 <xsd:sequence>
23 <xsd:element name="customer" type="CustomerType" minOccurs="0" maxOccurs="unbounded"
24 </xsd:sequence>
25 </xsd:complexType>
26 <xsd:element name="order" type="OrderType"/>
27 <xsd:element name="customer" type="CustomerType"/>
28 <xsd:complexType name="OrderType">
29 <xsd:sequence>
30 <xsd:element name="num" type="OrderNumType"/>
31 <xsd:element name="customer" type="CustomerType" maxOccurs="unbounded"/>
32 <xsd:element name="items" type="prod:ItemsType"/>
33 </xsd:sequence>
34 </xsd:complexType>
35 </xsd:schema>',
36 TRUE, TRUE, FALSE, FALSE);
37 END;
38 /
PL/SQL procedure successfully completed.
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 'chapter04infozipcode.xsd',
4 '<xsd:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns
//example.org/info/zipcode" targetNamespace="http://example.org/info/zipcode" elementFormDefault="unqualifie
5 <xsd:import namespace="http://example.org/ord" schemaLocation="chapter04ord1.xsd"/>
6 <xsd:complexType name="InfoType" xdb:SQLType="ZIPCODE_INFO_TYPE_T">
7 <xsd:complexContent>
8 <xsd:extension base="ord:InfoType">
9 <xsd:sequence>
10 <xsd:element name="zipcode" type="xsd:string"/>
11 <xsd:element name="suffix" type="xsd:string"/>
12 </xsd:sequence>
13 </xsd:extension>
14 </xsd:complexContent>
15 </xsd:complexType>
16 </xsd:schema>',
17 TRUE, TRUE, FALSE, FALSE);
18 END;
19 /
PL/SQL procedure successfully completed.
SQL>
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 'chapter04infostreet.xsd',
4 '<xsd:schema xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns
//example.org/info/street" targetNamespace="http://example.org/info/street" elementFormDefault="unqualified"
5 <xsd:import namespace="http://example.org/ord" schemaLocation="chapter04ord1.xsd"/>
6 <xsd:complexType name="InfoType" xdb:SQLType="STREET_INFO_TYPE_T">
7 <xsd:complexContent>
8 <xsd:extension base="ord:InfoType">
9 <xsd:sequence>
10 <xsd:element name="street" type="xsd:string"/>
11 <xsd:element name="suffix" type="xsd:string"/>
12 </xsd:sequence>
13 </xsd:extension>
14 </xsd:complexContent>
15 </xsd:complexType>
16 </xsd:schema>',
17 TRUE, TRUE, FALSE, FALSE);
18 END;
19 /
PL/SQL procedure successfully completed.
SQL>
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 'chapter04nonamespace.xsd',
4 '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ord="http://example.org/ord">
5 <xsd:import namespace="http://example.org/ord" schemaLocation="chapter04ord1.xsd"/>
6 <xsd:element name="info" type="ord:InfoType"/>
7 </xsd:schema>',
8 TRUE, TRUE, FALSE, FALSE);
9 END;
10 /
PL/SQL procedure successfully completed.
SQL>
SQL> CREATE TABLE customer (
2 name VARCHAR(64),
3 num INTEGER,
4 info XMLTYPE)
5 XMLType info STORE AS OBJECT RELATIONAL
6 XMLSCHEMA "chapter04nonamespace.xsd"
7 ELEMENT "info";
Table created.
SQL>
SQL> INSERT INTO customer (name, num, info)
2 VALUES ('George Jones', 1,
3 XMLType(
4 '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zipcode="http://example.org/info/zip
5 <zipcode>28877</zipcode>
6 <suffix>s1</suffix>
7 </info>'));
1 row created.
SQL>
SQL> INSERT INTO customer (name, num, info)
2 VALUES ('Jim Jones', 2,
3 XMLType(
4 '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:street="http://example.org/info/stre
5 <street>3456 Autumn Lane</street>
6 <suffix>s2</suffix>
7 </info>'));
1 row created.
SQL> /
1 row created.
SQL> SELECT name,
2 extractValue(info, '/info/zipcode'),
3 extractValue(info, '/info/street')
4 FROM customer
5 WHERE extractValue(info, '/info/zipcode/text()') LIKE '2%'
6 OR extractValue(info, '/info/street/text()') LIKE '3456%';
NAME
EXTRACTVALUE(INFO,'/INFO/ZIPCODE')
EXTRACTVALUE(INFO,'/INFO/STREET')
George Jones
28877
Jim Jones
3456 Autumn Lane
NAME
EXTRACTVALUE(INFO,'/INFO/ZIPCODE')
EXTRACTVALUE(INFO,'/INFO/STREET')
Jim Jones
3456 Autumn Lane
SQL>
SQL> CREATE UNIQUE INDEX customer_infozipcode ON customer(
2 extractValue
3 (
4 info,
5 '/info[@xsi:type="zipcode:InfoType"]/zipcode',
6 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7 xmlns:zipcode="http://example.org/info/zipcode"'
8 ))
9 /
Index created.
SQL> select column_name
2 from user_ind_columns
3 where INDEX_NAME = 'CUSTOMER_INFOZIPCODE'
4 /
COLUMN_NAME
SYS_NC00014$
SQL> select INDEX_NAME,COLUMN_EXPRESSION
2 from user_ind_expressions
3 /
INDEX_NAME
COLUMN_EXPRESSION
CUSTOMER_INFOZIPCODE
EXTRACTVALUE(SYS_MAKEXML('0341F05603124922B4F6F94DC5E30C2F',4870,"SYS_NC00004$",
SQL> DROP INDEX CUSTOMER_INFOZIPCODE
2 /
Index dropped.
SQL> desc INFO_TYPE_T
INFO_TYPE_T is NOT FINAL
Name Null? Type
SYS_XDBPD$ XDB.XDB$RAW_LIST_T
SQL> --
SQL> desc ZIPCODE_INFO_TYPE_T
ZIPCODE_INFO_TYPE_T extends OTNTEST.INFO_TYPE_T
ZIPCODE_INFO_TYPE_T is NOT FINAL
Name Null? Type
SYS_XDBPD$ XDB.XDB$RAW_LIST_T
zipcode VARCHAR2(4000 CHAR)
suffix VARCHAR2(4000 CHAR)
SQL> --
SQL> desc STREET_INFO_TYPE_T
STREET_INFO_TYPE_T extends OTNTEST.INFO_TYPE_T
STREET_INFO_TYPE_T is NOT FINAL
Name Null? Type
SYS_XDBPD$ XDB.XDB$RAW_LIST_T
street VARCHAR2(4000 CHAR)
suffix VARCHAR2(4000 CHAR)
SQL> --
SQL> CREATE UNIQUE INDEX customer_infozipcode ON customer(TREAT(INFO.XMLDATA AS ZIPCODE_INFO_TYPE_T)."zipcod
2 /
Index created.
SQL> select column_name
2 from user_ind_columns
3 where INDEX_NAME = 'CUSTOMER_INFOZIPCODE'
4 /
COLUMN_NAME
TREAT("SYS_NC00007$" AS "ZIPCODE_INFO_TYPE_T")."zipcode"
SQL> select INDEX_NAME,COLUMN_EXPRESSION
2 from user_ind_expressions
3 /
no rows selected
SQL> INSERT INTO customer (name, num, info)
2 VALUES ('Jerry Jones', 3,
3 XMLType(
4 '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zipcode="http://example.org/info/zip
5 <zipcode>28877</zipcode>
6 <suffix>s1</suffix>
7 </info>'))
8 /
INSERT INTO customer (name, num, info)
ERROR at line 1:
ORA-00001: unique constraint (OTNTEST.CUSTOMER_INFOZIPCODE) violated
SQL> INSERT INTO customer (name, num, info)
2 VALUES ('Jerry Jones', 3,
3 XMLType(
4 '<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:street="http://example.org/info/stre
5 <street>3456 Autumn Lane</street>
6 <suffix>s3</suffix>
7 </info>'))
8 /
1 row created.
SQL>In you solution a functional index was created. In my case, by breaking the XML abstraction, and using object-relational SQL to create the index (DDL statements are the one case where I feel this is acceptable) I was able to create a pure B-TREE index which has the same effect.. -
ORA-01450 when trying to create index on xmltype column
Hi,
I have a table that contains an xmltype column. It is a schema-based column and uses object-relational structured storage. When I tried to create an index like:
create index ssual_sipuser_idx on ssua_line (extractValue(ssual_configuration, '/ssuaLineApplication/sipUser'));
I got the following:
ORA-01450: maximum key length (3118) exceeded
The sipUser tag is of string type. I have also tried creating the index on the extract function.
create index ssual_sipuser_idx on ssua_line (ssual_configuration.extract('/ssuaLineApplication/sipUser/text()').getStringVal())
Gave me the same error message. My database block size is 4k. This is Oracle 9.2.0.4 running on Solaris.
Any help will be appreciated.
Thanks,
GloriaThanks for the reply, Coby.
My field is really small, probably around 10 bytes. Actually I've been testing on two servers, a 9201 and a 9204. I know that Oracle doesn't support XML DB on 9201 anymore but our company hasn't switched over yet. Anyways, here's really what I saw:
9201
- creating an index with extractValue() or extract() doesn't work
9204
- extractValue() works
- extract() still doesn't work
Now I'm using the substr() workaround. I should also mention that extractValue() with a numeric field works (using getNumberVal()).
I wonder if specifying the field length in the XML Schema would make a difference. I may try that next. -
Issues with using XMLType indexes against a table with XMLType column
I am attempting to use an XMLIndex with a Structured Component and not having too much luck. Not much data in metalink nor is the documentation very helpful:
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb_indexing.htm#BCGHGIGC
The table DDL is as follows:
CREATE TABLE ECI_SCHEMA.REV_ITEM_EARN_DTL_VIRTUAL(
REV_ITEM_EARN_DTL_ID_NBR NUMBER(16,0) NOT NULL,
UNIQ_MSG_ID_NBR VARCHAR2(50) NOT NULL,
REV_ITEM_BILL_DTL_ID_NBR NUMBER(16,0),
PLAN_RACN_NBR NUMBER(10,0) NOT NULL,
INV_DTL_IMG SYS.XMLType NOT NULL,
NON_INV_DTL_IMG BLOB NOT NULL,
PART_KEY_CD GENERATED ALWAYS AS (MOD(PLAN_RACN_NBR,5)) VIRTUAL,
LAST_UPDT_TMSTP TIMESTAMP(6) NOT NULL,
INV_ID_NBR NUMBER(16,0),
ITEM_STATUS_CD VARCHAR2(1) DEFAULT 'A' NOT NULL
LOB (NON_INV_DTL_IMG) STORE AS NON_IDI_LOB (CHUNK 8192 PCTVERSION 10 CACHE)
TABLESPACE ECI_DATA
PARTITION BY RANGE (PART_KEY_CD)
PARTITION RIED_DAY0_PART
VALUES LESS THAN (1)
TABLESPACE ECI_DATA
PARTITION RIED_DAY1_PART
VALUES LESS THAN (2)
TABLESPACE ECI_DATA
PARTITION RIED_DAY2_PART
VALUES LESS THAN (3)
TABLESPACE ECI_DATA
PARTITION RIED_DAY3_PART
VALUES LESS THAN (4)
TABLESPACE ECI_DATA
PARTITION RIED_MAXVAL_PART
VALUES LESS THAN (MAXVALUE)
TABLESPACE ECI_DATA
XMLTYPE COLUMN "INV_DTL_IMG" STORE AS OBJECT RELATIONAL
XMLSCHEMA "someXdbDocument.xsd"
ELEMENT "revenueInvoice"
According to the documentation, I should be able to create a structured XMLIndex on the XMLType column with the following syntax:
SQL> create index eci_schema.rev_item_earn_dtl_virt_xmlix on eci_schema.rev_item_earn_dtl_virtual
2 (INV_DTL_IMG)
3 INDEXTYPE IS XDB.XMLIndex
4 parameters ('PATH TABLE RIED_PATH_TABLE')
5 local;
When I do this, I get the following error:
create index eci_schema.rev_item_earn_dtl_virt_xmlix on eci_schema.rev_item_earn_dtl_virtual
ERROR at line 1:
ORA-29958: fatal error occurred in the execution of ODCIINDEXCREATE routine
ORA-30959: The indexed column is not stored in CLOB.
What am I doing wrong? Based on the Oracle documentation, I was under the impression that 11.2 XMLIndex would work with Object Relational storage. Is this not the case?CREATE INDEX ECI_SCHEMA.REV_ITEM_EARN_DTL_IX7
ON ECI_SCHEMA.REV_ITEM_EARN_DTL
extractValue(inv_dtl_img, '/revenueInvoice/service/transportation/mstrTrkngNbr')
TABLESPACE ECI_REV_ITEM_EARN_DTL_IX7_ITS
LOGGING
PARALLEL(DEGREE 8 INSTANCES 1)
LOCAL
/Elements that occur at most once in each document can be indexed using extractValue(). Despite the fact that the index appears to be a functional index, when we create the index we automatically re-write the create index into a normal btree index on the column that contains the value for the element identified by the xpath.
Eg in the case of a functional index based on extractValue, defined on XMLType using Object relational storage, with an xpath that identifies a node that occurs at most once in each document is not a functional index, it's re-written into a plain old vanilla btree index. You can actually check this by looking in the system tables
Eg
SQL> connect system/oracle
Connected.
SQL> select table_name, index_name from all_indexes where owner = 'OE' and table_name = 'PURCHASEORDER';
TABLE_NAME INDEX_NAME
PURCHASEORDER LINEITEM_TABLE_MEMBERS
PURCHASEORDER ACTION_TABLE_MEMBERS
PURCHASEORDER SYS_C0011037
SQL> alter session set current_schema = OE
2 /
Session altered.
SQL> create unique index PO_REF_INDEX on PURCHASEORDER (extractValue(object_value,'/PurchaseOrder/Reference'));
Index created.
SQL> set lines 250
SQL> select index_name, index_type from all_indexes where owner = 'OE' and table_name = 'PURCHASEORDER';
INDEX_NAME INDEX_TYPE
PO_REF_INDEX NORMAL
LINEITEM_TABLE_MEMBERS NORMAL
ACTION_TABLE_MEMBERS NORMAL
SYS_C0011037 NORMAL
SQL> select * from dba_ind_expressions where table_name = 'PURCHASEORDER' and index_owner = 'OE'
2 /
no rows selectedFrom the above we can see that the index created on extractValue has been re-written in a plain old vanilla BTREE index, and there is no definition for it in dba_ind_expressions So assuming you were able to create the index and insert the data you should find that your index is not a functional index.
] -
How to create a Context index on a Substitutable Column ?
Hi all,
I have a type t1 and a subtype t2 which defines a new
sys.XMLType column d and a table t_tab of t1.
If I issue the following :
create index t_idx on t_tab t(treat(value(t) as t2).d) indextype
is ctxsys.context;
I get the following message:
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE
routine
ORA-20000: Oracle Text error:
DRG-50857: oracle error in drsxsopen
ORA-00904: invalid column name
ORA-06512: at "CTXSYS.DRUE", line 157
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 176
Any suggestion ?
Thanks
AlexAlex,
Please file an iTAR report at http://metalink.oracle.com. This
could be a known bug.
Regards,
Geoff
Hi all,
I have a type t1 and a subtype t2 which defines a new
sys.XMLType column d and a table t_tab of t1.
If I issue the following :
create index t_idx on t_tab t(treat(value(t) as t2).d) indextype
is ctxsys.context;
I get the following message:
ERROR at line 1:
ORA-29855: error occurred in the execution of ODCIINDEXCREATE
routine
ORA-20000: Oracle Text error:
DRG-50857: oracle error in drsxsopen
ORA-00904: invalid column name
ORA-06512: at "CTXSYS.DRUE", line 157
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 176
Any suggestion ?
Thanks
Alex
Maybe you are looking for
-
How can I locate my lost iPod Touch if my location was off and user ID was changed?
I lost 3 Apple devices during house break in. How can I locate my lost Apple devices if my location was turn off, without "Find My Phone" apps and user ID was changed. The 3 devices are iPod Touch, iPad 2 and iPhone 3gs. I had made a Police Report an
-
I have a library with almost 3000 movies and TV shows that I have fully tagged. However, I have decided to start using Windows Media Center and it does its metadata tagging through XML files. I wanted to know if anyone could tell me if there was a w
-
Man I am ******. How do I revert and get rid of this crappy iTunes 11?? I can't add any files to my library. I drag and drop, I try to open them with iTunes, import them through the menu, NOTHING works. It just sits there doing nothing. This includes
-
Using interop DLL to rename steps?
I am using teststand 2.0 If I rename a step in the Sequence Editor, the editor will automatically update all references to the step (in preconditions, pre/post expressions and so on) to match the new name. The problem: I am writing a program that use
-
hi friends, My client require following, They have twenty thousand materials..., in that five thousand materials are high value materials. they need release procedure for these 5000 materials only... is it possible at Purchase order level or purchase