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...

Similar Messages

  • XML SCHEMA validation question

    i'm using jdk 1.4.2 and am trying to validate an xml document against an xml schema. i don't have any packages like xerces or apache and am trying to avoid having to use them. i've had a look at the jdk 1.5 api documentation, and it seems to have some new classes dedicated to xml validation using schemas that 1.4.2 does not have (e.g. the Schema class). my question is, is it possible to do xml validation against a schema only using jdk 1.4.2 and without the likes of the xerces and apache parser packages?
    any help much appreciated, thanks

    The tutorial on Schema Validation parses/validates with the SAXParserFactory. J2sdk 1.4.2 JAXP has an error in the implementation of the SAXParserFactory. Parse/validate with the DocumentBuilderFactory instead of the SAXParserFactory.
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPSAX9.html

  • XML Schema Design question

    Hello all,
    I am a new to XML Schema design and struggling with designing my first XML Schema. Here is my problem.
    I have almost 200 elements in my database which I have to use to design XSDs, I have customer name ( last name, first name, dob etc) and customer address ( office address, home address etc) and at the same time I have other player such as Patient name ( last name, first name, dob etc) and patient address( home address, office address).
    And then we have some dollor related data such as patient insurance amount, copay amount , total amount and many more $.
    What I wanted to know is that what would be best approach to design a XML schema for such kind of system, should I create one schema (xsd) for all the 200 attributes or I should create seperate schema for customers ( including names and addresses along with other dollor amount data ) and a similar xsd for Patient data. Some of the XML documents which I will create from these schemas would be based on customers and patient information both .
    Thank you.
    Regards
    Suhail Ahmad

    It's hard to tell what is the best design. But in order to simplify access to these data through other program APIs such as JAXB, you may start from defining objects such as the schema types/elements for customer, patient and the addresses
    Then you can assoicate the related data to these object.

  • XML Schema - Two Questions

    1. Can a validation requirement such as the one in the following
    example be specified in the XML 1.0 schema:
    The identification information for a student must include either a
    social security number (SSN) or a student id. It is also valid to
    specify both.
    We were able to specify an exclusive or, that is either A or B, using
    the choice group element. A choice group element allows only one of its
    children to appear in an instance and thus works for the case of either
    SSN or student id.
    Can the choice feature be extended to accommodate the inclusive or
    case, that is either A or B or both, as stated in the validation
    requirement?
    If choice cannot be used, is there another schema feature that can be
    used to accommodate this case?
    2. Is there any way to allow child elements of a group to have a
    maxOccurs greater than 1 while at the same time allowing the elements to
    occur in any order. The default, sequence, indicates that the
    sequence of elements within a group must follow the order indicated in
    the schema. The all group allows for flexibility in the order, but
    restricts maxOccurs to 0 or 1. Looking at the following example:
    <complexType name=description>
    <element name=tattoos minOccurs=0 maxOccurs=100>
    <element name= birthdate minOccurs=0 maxOccurs=1>
    <element name=nicknames minOccurs=0 maxOccurs=10>
    </complexType>
    We would like to allow multiple occurrences of tattoos and nicknames and
    also allow the three elements (tattoos, birthdate, nicknames) to be
    specified in any order.
    Is it possible to do this in XML Schema 1.0 and, if so, what is the
    correct syntax?

    1. You may use somewhat cumbersome syntax like:
    choice
    A
    B
    all
    A
    B
    /all
    /choice
    to implement inclusive or.
    2. They (W3 Schema WG) were talking about
    this but decided not to allow it (at least for now). A workaround you may use:
    all
    group ref = group1
    group ref = group2
    /all
    group name=group1
    elem ... maxOccurs = 10
    /group
    Something like that.
    null

  • NOT ABLE TO RECLAIM STORAGE USED BY XMLTYPE COLUMN

    Since we are on Oracle 9i, the 10G solution DBMS_XMLSCHEMA.CopyEvolve() is not available, we are trying to do it by ourselves.
    see the doc,
    Re: how to make xml schema change when there are existing records in the ta
    However, our requirement is different in the following ways:
    1. We hope to be able to add/drop as many XMLTYPE columns to a table as we
    want( all structured storage, but with different schemas).
    2. When a XMLTYPE Schema needs to be updated, we will add a new
    xmltype column, assign it the new schema and migrate the data from the old column. After that we want to drop the old xmltype column and it's schema to reclaim all the storage.
    The underlying xml tables are drop, space reclaimed.
    However, we found out that the segment/blocks/bytes of the xmltype column itself is not released.
    Question:
    1. Since Xmltype column associated with xmltype schema is structured
    stored, the xmldoc should parsed and stored in underlying tables. However, it seems that the xmltype column itself is acquiring sunstantial amount of space.
    By querying user_segments table, we saw the underlying structure is actually taking constant and small space, however, the main table is taking huge space.(We populated the table with 61K rows), For instance,
    SEGMENT_NAME BYTES SEGMENT_TYPE
    PERFORMANCEEVENT 260046848 TABLE
    SYS_C007080275 1048576 INDEX
    Performance1833_TAB 65536 TABLE
    Date1831_TAB 65536 TABLE
    LocationAddress1814_TAB 65536 TABLE
    SYS_IL0010401244C00018$$ 65536 LOBINDEX
    SYS_IL0010401244C00012$$ 65536 LOBINDEX
    Where PERFORMANCEEVENT is the main table.
    Why?

    Try to read this post.
    This will give you an idea about the way and when xml is shred into tables.
    XMLType column based on XML Schema: several questions
    In your case since you are not using the default table, the data is stored witin the table itself as oracle has not shred the data.

  • XML Schema based XMLType column leaves file open on error

    Hello,
    I have the following situation on both oracle 10.1.0.2.0 and 10.1.0.4.0:
    insert into xml_products (xmlfile) values(bfilename(file_loc, char_id));
    "xmlfile" is a xmltype column based on a registered xml schema.
    When the file fails xml schema validation, the file remains open and I cannot move it until i close the session.
    Is this a bug or an "intentional feature"?
    Any workarounds?
    Thanks,
    Flavio

    All right Mark,
    thanks for your reply.
    Meanwhile I fixed the problem and posted my workaround here:
    http://oraclequirks.blogspot.com/2005/11/ora-29292-and-xmltype.html
    Bye,
    Flavio

  • Multiple XML schema in structured XMLType column possible?

    I have registered several different xml schema in my 10g database. I have a table with an XMLType column. That column will always hold one XML document that conforms to one of the XML schema. Question: does that by definition mean I have to use "unstructured" storage, or there any way to use structured storage telling Oracle that the XMLType conforms to xsd1 OR xsd2 OR xsd3?
    Thanks.

    In 10gR2 a column based on an XML Schema and using object-relation storage can be bound to one global element. The only way for a column to hold documents associated with more than one global element is if both elements are defined as members of the same substition group.

  • Insert data into the xml schema-based xmltype table problem!

    Hello, there,
    I got problem in inserting data into the xmltype table after registered XML schema and created table. details see below:
    1) xml schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Constantin Ilea (EMERGIS INC) -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" targetNamespace="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" elementFormDefault="qualified">
         <!-- ************** PART I: BEGIN SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
         <xs:simpleType name="RoutingType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="Synch"/>
                   <xs:enumeration value="Asynch"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="StatusType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ACTIVE"/>
                   <xs:enumeration value="VOID"/>
                   <xs:enumeration value="PENDING"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="SenderApplicationType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="PR"/>
                   <xs:enumeration value="CR"/>
                   <xs:enumeration value="POS"/>
                   <xs:enumeration value="CPP"/>
                   <xs:enumeration value="Other"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ServiceTypeType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="IS"/>
                   <xs:enumeration value="WS"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="RouteDirect">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="Request"/>
                   <xs:enumeration value="Reply"/>
                   <xs:enumeration value="None"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="Indicator">
              <xs:annotation>
                   <xs:documentation>can we also change the value to "ON" and "OFF" instead? in this way this cn be shared by all type of switch indicator</xs:documentation>
              </xs:annotation>
              <xs:restriction base="xs:string">
                   <xs:enumeration value="YES"/>
                   <xs:enumeration value="NO"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="RuleType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ControlAct"/>
                   <xs:enumeration value="WSPolicy"/>
                   <xs:enumeration value="AccessControl"/>
                   <xs:enumeration value="Certification"/>
                   <xs:enumeration value="MessageConformance"/>
                   <xs:enumeration value="Variant"/>
                   <xs:enumeration value="Routing"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="HL7Result">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ACCEPT"/>
                   <xs:enumeration value="REFUSE"/>
                   <xs:enumeration value="REJECT"/>
                   <xs:enumeration value="ACK"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="IIPType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="PUT"/>
                   <xs:enumeration value="GET/LIST"/>
                   <xs:enumeration value="NOTIF"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ProfileTypeType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="IIPProfile"/>
                   <xs:enumeration value="BizOperationProfile"/>
                   <xs:enumeration value="OrchestrationProfile"/>
                   <xs:enumeration value="DomainObjectProfile"/>
                   <xs:enumeration value="ServiceProfile"/>
                   <xs:enumeration value="ExceptionProfile"/>
                   <xs:enumeration value="CustomizedProfile"/>
                   <xs:enumeration value="SystemProfile"/>
                   <xs:enumeration value="HL7XMLSchemaProfile"/>
                   <xs:enumeration value="EnricherParametersProfile"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ParameterType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="String"/>
                   <xs:enumeration value="Object"/>
                   <xs:enumeration value="Number"/>
                   <xs:enumeration value="Document"/>
              </xs:restriction>
         </xs:simpleType>
         <!-- ************** PART I: END SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
         <!-- ************** PART II: BEGIN COMPLEX OBJECT TYPE DEFINITIONS ********************************** -->
         <!-- *********************** begin new added objects, by rshan *************************************** -->
         <xs:complexType name="ProfileType">
              <xs:annotation>
                   <xs:documentation>
              1.Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
              2.ProfileID used to uniquely identify the current profile
              3.ProfileData used to hold all the necessary profile related data
              </xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="ProfileID" type="ProfileIDType">
                        <xs:annotation>
                             <xs:documentation>this will hold all the common attributes, espically the global unique identifier to the profile, no matter what type of profile is</xs:documentation>
                        </xs:annotation>
                   </xs:element>
                   <xs:element name="ProfileData" type="ProfileDataType">
                        <xs:annotation>
                             <xs:documentation>all the non-common profile meta data that attached to each specific profile type such as IIPProfile, OrchestrationProfile, and BizOperationProfile will be placed here</xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="ProfileIDType">
              <xs:annotation>
                   <xs:documentation>global unique identifier and all the common attributes across all different profiles, the @ID and @Type together will be used as the primary key to identify the profile data</xs:documentation>
              </xs:annotation>
              <xs:attribute name="ID" type="xs:ID" use="required">
                   <xs:annotation>
                        <xs:documentation>ID is the global unique identifier to the profile, no matter what type of profile it is</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Name"/>
              <xs:attribute name="Description"/>
              <xs:attribute name="Version">
                   <xs:annotation>
                        <xs:documentation>version of the profile data</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Type" type="ProfileTypeType" use="required">
                   <xs:annotation>
                        <xs:documentation>value to identify the ProfileType type within
                        IIPProfile,BizOperationProfile,OrchestrationProfile,DomainObjectProfile
                        ServiceProfile,ExceptionProfile,SystemProfile,HL7XMLSchemaProfile,
                        EnricherParametersProfile,CustomizedProfile
                        </xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Status" type="StatusType" default="ACTIVE">
                   <xs:annotation>
                        <xs:documentation>used to show the related profile data status like "ACTIVE","PENDING","VOID"...</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <!--
              <xs:sequence>
                   <xs:element name="ProfileReference" type="ProfileIDType" minOccurs="0" maxOccurs="unbounded">
                        <xs:annotation>
                             <xs:documentation>this will be the place to hold the integrity relationship with other profiles like foreign key if existed and necessary to show up</xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:sequence>
              -->
         </xs:complexType>
         <xs:complexType name="ProfileDataType">
              <xs:annotation>
                   <xs:documentation>meta data associated tightly to each specific type of profile</xs:documentation>
              </xs:annotation>
              <xs:choice>
                   <xs:element name="EnricherParametersProfileData" type="EnricherParametersDataType">
                        <xs:annotation>
                             <xs:documentation>Enricher Parameters related profile data
                   1. one instance of this type may contains all the related System metadata.
                   2. idType part may use to identify different version/release/status
                   </xs:documentation>
                        </xs:annotation>
                   </xs:element>
                   <xs:element name="ExtendProfileData" type="ExtendProfileDataType">
                        <xs:annotation>
                             <xs:documentation>If needed, any profile data not defined within the current release scope can be added here </xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="ExtendProfileDataType">
              <xs:sequence>
                   <xs:element name="ExtendProfile" type="xs:anyType" minOccurs="0"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="EnricherParametersDataType">
              <xs:sequence>
                   <xs:element name="EnricherParameter" type="EnricherParameter" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="EnricherParameter">
              <xs:sequence>
                   <xs:element ref="Enricher"/>
              </xs:sequence>
              <xs:attribute name="serviceName" type="xs:string" use="required"/>
              <xs:attribute name="interactionID" type="xs:string"/>
         </xs:complexType>
         <xs:element name="Enricher">
              <xs:annotation>
                   <xs:documentation>Comment describing your root element</xs:documentation>
              </xs:annotation>
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Parameters" type="Parameters"/>
                        <xs:element ref="Section" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:complexType name="ValueType">
              <xs:attribute name="field" use="required"/>
              <xs:attribute name="value"/>
              <xs:attribute name="action"/>
         </xs:complexType>
         <xs:element name="Section">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Value" type="ValueType" minOccurs="0" maxOccurs="unbounded"/>
                        <xs:element ref="Section" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
                   <xs:attribute name="path" use="required"/>
              </xs:complexType>
         </xs:element>
         <xs:complexType name="Parameters">
              <xs:sequence>
                   <xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded">
                        <xs:complexType>
                             <xs:attribute name="name" use="required"/>
                             <xs:attribute name="reference"/>
                        </xs:complexType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="RuleList">
              <xs:annotation>
                   <xs:documentation>an array of rules</xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="Rule" type="RuleProfile" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="RuleProfile">
              <xs:attribute name="RName" use="required"/>
              <xs:attribute name="RType" type="RuleType" use="required"/>
              <xs:attribute name="Status" default="ON">
                   <xs:annotation>
                        <xs:documentation>By default is ON (or if is missing)</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Order"/>
              <xs:attribute name="Direction" type="RouteDirect">
                   <xs:annotation>
                        <xs:documentation>Request / Reply</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
         </xs:complexType>
         <!-- ************** PART II: END COMPLEX OBJECT TYPE DEFINITIONS *********************************** -->
         <!-- ************** PART III: BEGIN ROOT ELEMENTS DEFINITIONS ********************************* -->
         <!-- 0) Profile wrapper root element
    Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
    -->
         <xs:element name="Profile" type="ProfileType">
              <xs:annotation>
                   <xs:documentation>Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS</xs:documentation>
              </xs:annotation>
         </xs:element>
    </xs:schema>
    2)register xml schema:
    SQL> begin
    2 dbms_xmlschema.registerSchema
    3 (
    4 schemaurl=>'http://rac3-1-vip:8080/home/'||USER||'/xsd/EHIPProfile_v00.xsd',
    5 schemadoc=>xdbURIType('/home/'||USER||'/xsd/EHIPProfile_v00.xsd').getClob(),
    6 local=>True,
    7 gentypes=>True,
    8 genbean=>False,
    9 gentables=>False
    10 );
    11 End;
    12 /
    PL/SQL procedure successfully completed.
    SQL>
    SQL>
    3) xml data:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
    <Profile xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1">
         <ProfileID Type="EnricherParametersProfile" Status="ACTIVE" ID="EnricherPP.ID.0001" Name="EnricherPP.ID.0001" Description="EnricherPP.ID.0001" Version="01"/>
         <ProfileData>
              <EnricherParametersProfileData>
                   <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.ExceptionCreators:createExceptionV50CategoryCanonicalPart" interactionID="">
                   <Enricher>
                        <Parameters>
                             <Parameter name="MESSAGE_ID" reference="test"/>
                        </Parameters>
                        <Section path="HEADER">
                             <Section path="RESPONSE_TYPE">
                                  <Value field="value" value="I"/>
                             </Section>
                             <Section path="HL7_STANDARD_VERSION">
                                  <Value field="value" value="HL7V3"/>
                             </Section>
                             <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                                  <Value field="value" value="NE"/>
                             </Section>
                             <Section path="SENDING_NETWORK_ADDRESS">
                                  <Value field="value" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_NAME">
                                  <Value field="value" value="NL HIAL"/>
                             </Section>
                        </Section>
                   </Enricher>
         </EnricherParameter>
              <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectCreators:createFindClientsAssociatedIdentifersRequestObject" interactionID="PRPA_IN101105CA">
                   <Enricher>
                        <Parameters>
                             <Parameter name="MESSAGE_ID" reference="test"/>
                        </Parameters>
                        <Section path="HEADER">
                             <Section path="RESPONSE_TYPE">
                                  <Value field="value" value="I"/>
                             </Section>
                             <Section path="HL7_STANDARD_VERSION">
                                  <Value field="value" value="HL7V3"/>
                             </Section>
                             <Section path="PROCESSING_CODE">
                                  <Value field="value" value="T"/>
                             </Section>
                             <!--
                             <Section path="PROCESSING_MODE_CODE">
                                  <Value field="value" value="T"/>
                             </Section>
                             -->                         
                             <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                                  <Value field="value" value="NE"/>
                             </Section>
                             <Section path="RECEIVER_NETWORK_ADDRESS">
                                  <Value field="value" value="prsunew.moh.hnet.bc.ca"/>
                             </Section>
                             <Section path="RECEIVER_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.40.5.1"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_NETWORK_ADDRESS">
                                  <Value field="value" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_NAME">
                                  <Value field="value" value="NL HIAL"/>
                             </Section>
                        </Section>
                   </Enricher>
         </EnricherParameter>
              <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectContentEnrichers:enrichPRRequest" interactionID="">
    <!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
    <Enricher>
         <Parameters>
              <Parameter name="MESSAGE_IDENTIFIER" reference="test"/>
         </Parameters>
         <Section path="HEADER">
              <Section path="HL7_STANDARD_VERSION">
                   <Value field="value" value="V3PR2"/>
              </Section>
              <!--POS/CPP populated ?-->
              <!--Not sure if this should be set as a variance within EHIP or if we expect the POS/CPP to provide this value-->
              <Section path="PROCESSING_CODE">
                   <Value field="value" value="T"/>
              </Section>
              <!--POS/CPP populated ?-->
              <Section path="PROCESSING_MODE_CODE">
                   <Value field="value" value="T"/>
              </Section>
              <!--POS/CPP populated ?-->
              <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                   <Value field="value" value="NE"/>
              </Section>
              <!-- note:We Expect PRS to give us a web service address -->                    
              <!--<Section path="RECEIVER_NETWORK_ADDRESS">
                   <Value field="value" value="_http://PRSServer/svcName"/>
              </Section>
              -->
              <Section path="RECEIVER_APPLICATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.3.40.1.14"/>
                   <Value field="extension" value="SIT1"/>
              </Section>
              <!-- note: values of the fields to be provided by PRS -->
              <Section path="RECEIVER_APPLICATION_NAME[0]">
                   <Value field="value" value="receiverAppName"/>
              </Section>
              <!-- note: RECEIVER_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <!-- note: values of the fields to be specified by PRS later -->
              <Section path="RECEIVER_AGENT/RECEIVER_ORGANIZATION/RECEIVER_ORGANIZATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.3.40.4.1"/>
                   <Value field="extension" value="receiverOrgId"/>
              </Section>
              <Section path="SENDING_APPLICATION_NAME[0]">
                   <Value field="value" value="NLPRSCLNT"/>
              </Section>
              <!-- note: SENDING_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <!-- note: values of the fields to be specified by PRS later -->
              <Section path="SENDING_AGENT/SENDING_ORGANIZATION/SENDING_ORGANIZATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.4.3.57"/>
                   <Value field="extension" value="3001"/>
              </Section>
              <Section path="PERFORMER/HEALTHCARE_WORKER_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.4.3.57"/>
                   <Value field="extension" value="HIAL_USR"/>
              </Section>          
         </Section>
         <Section path="PAYLOAD">
              <!--<Section path="QUERY_STATUS_CODE">
                   <Value field="value" value="New"/>
              </Section>-->
              <!-- note: AUDIT has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="AUDIT[0]/AUDIT_INFORMATION">
                   <Value field="code" value="LATEST"/>
                   <Value field="codeSystem" value="PRSAuditParameters"/>
              </Section>
              <!-- note: CONFIDENCE has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="CONFIDENCE/CONFIDENCE_VALUE">
                   <Value field="value" value="100"/>
              </Section>
              <!-- note: HISTORY has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="HISTORY/INCLUDE_HISTORY_INDICATOR">
                   <Value field="value" value="false"/>
              </Section>
              <!-- note: JURISDICTION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="JURISDICTION/JURISDICTION_TYPE">
                   <Value field="value" value="NL"/>
              </Section>
              <!-- note: RESPONSE_OBJECT has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[0]">
                   <Value field="code" value="GRS_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[1]">
                   <Value field="code" value="GRS_ELECTRONIC_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[2]">
                   <Value field="code" value="GRS_IDENTIFIER"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[3]">
                   <Value field="code" value="GRS_ORGANIZATION_NAME"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[4]">
                   <Value field="code" value="GRS_PERSONAL_NAME"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[5]">
                   <Value field="code" value="GRS_REGISTRY_IDENTIFIER"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[6]">
                   <Value field="code" value="GRS_TELEPHONE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[7]">
                   <Value field="code" value="PRS_CONDITION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[8]">
                   <Value field="code" value="PRS_CONFIDENTIALITY_INDICATOR"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[9]">
                   <Value field="code" value="PRS_DEMOGRAPHIC_DETAIL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[10]">
                   <Value field="code" value="PRS_DISCIPLINARY_ACTION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[11]">
                   <Value field="code" value="PRS_INFORMATION_ROUTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[12]">
                   <Value field="code" value="PRS_NOTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[13]">
                   <Value field="code" value="PRS_PROVIDER_CREDENTIAL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[14]">
                   <Value field="code" value="PRS_PROVIDER_EXPERTISE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[15]">
                   <Value field="code" value="PRS_PROVIDER_RELATIONSHIP"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[16]">
                   <Value field="code" value="PRS_STATUS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[17]">
                   <Value field="code" value="PRS_WORK_LOCATION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[18]">
                   <Value field="code" value="PRS_WORK_LOCATION_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[19]">
                   <Value field="code" value="PRS_WORK_LOCATION_DETAIL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[20]">
                   <Value field="code" value="PRS_WORK_LOCATION_ELECTRONIC_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[21]">
                   <Value field="code" value="PRS_WORK_LOCATION_INFORMATION_ROUTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[22]">
                   <Value field="code" value="PRS_WORK_LOCATION_TELEPHONE"/>
              </Section>
              <!-- note: ROLE_CLASS has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="ROLE_CLASS /ROLE_CLASS_VALUE">
                   <Value field="value" value="LIC"/>
              </Section>
              <Section path="SORT_CONTROL[0]/SORT_CONTROL_ELEMENT_NAME">
                   <Value field="code" value="PrincipalPerson.name.value.family"/>
              </Section>
              <Section path="SORT_CONTROL[0]/SORT_CONTROL_DIRECTION_CODE">
                   <Value field="value" value="A"/>
              </Section>
         </Section>
    </Enricher>
         </EnricherParameter>
              </EnricherParametersProfileData>
         </ProfileData>
    </Profile>
    the data is valid against the schema through XML Spy tool... and loaded into the XDB repository...
    4) create table and insert data:
    SQL> CREATE TABLE EHIP_PROFILE OF SYS.XMLTYPE
    2 XMLSCHEMA "http://rac3-1-vip:8080/home/EHIPSBUSER1/xsd/EHIPProfile_v00.xsd" ELEMENT "Profile"
    3 ;
    Table created.
    SQL>
    SQL> alter table EHIP_PROFILE
    2 add CONSTRAINT EHIP_PROF_PK PRIMARY KEY(XMLDATA."ProfileID"."ID",XMLDATA."ProfileID"."Type");
    Table altered.
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> select xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob() from dual;
    XDBURITYPE('/HOME/'||USER||'/PROFILEDATA/ENRICHERPP.ID.0001.XML').GETCLOB()
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy
    SQL>
    SQL>
    SQL> insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()));
    insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()))
    ERROR at line 1:
    ORA-21700: object does not exist or is marked for delete
    what's the problem caused the "ORA-21700: object does not exist or is marked for delete" error?
    Thanks in advance for your help?

    Thanks Marco,
    Here're my environment:
    SQL> select INSTANCE_NUMBER, INSTANCE_NAME,HOST_NAME,VERSION from v$instance;
    INSTANCE_NUMBER INSTANCE_NAME HOST_NAME VERSION
    2 rac32 RAC3-2 10.2.0.3.0
    I followed your suggested in the above, and always purge recyclebin, but still got the same problem. because in 10gr2, there's no dbms_xmlschema.purge_schema available,
    and I did checked the recyclebin after force the delete of schema, nothing inside. any other recommendation?

  • LPX-00004 - Problems while inserting xml files in a xmltype column

    I've faced two problems while trying to insert xml files into my table containing a xmltype column:
    create table xml_test (id number(20),content xmltype)
    I use following java code for writing xml docs into db:
         conn.setAutoCommit(false);
         OraclePreparedStatement stmt = (OraclePreparedStatement)
              conn.prepareStatement("INSERT INTO xml_test (id,content) VALUES(?,?)");
         File file = new File(file1);
         InputStream in1 = new FileInputStream(file1);
         Reader r1 = new BufferedReader(new InputStreamReader(in1, "UTF-8"));
         int len = 0;
         StringBuffer text = new StringBuffer();
         while ((len = r1.read()) != -1) {
              text.append((char) len);
         in1.close();
         r1.close();
         XMLType poXML1 = XMLType.createXML(conn, text.toString());
         for (int i = 1; i <= 1; i++) {
              stmt.setInt(1, i);
              stmt.setObject(2, poXML1);
              stmt.execute();
         conn.commit();
    1. problem: occures only if a xml schema has been assoicated to the specific xmltype column. it seems that the length of a specific xml tag in the document is limited. but why?
    java.sql.SQLException: ORA-22814: attribute or element value is larger than specified in type
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
         at test.insertXML(test.java:84)
         at test.main(test.java:261)
    hier the xml-schema of the xmltype column "content":
    <?xml version="1.0" encoding="UTF-8"?>
    <!--W3C Schema generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
         <xs:element name="AUTOR-ID" type="xs:string"/>
         <xs:element name="BODY" type="xs:string"/>
         <xs:element name="CONTENT">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="METADATEN"/>
                        <xs:element ref="BODY"/>
                   </xs:sequence>
                   <xs:attribute name="content-id" type="xs:string" use="required"/>
              </xs:complexType>
         </xs:element>
         <xs:element name="DATUM" type="xs:string"/>
         <xs:element name="KEYWORD" type="xs:string"/>
         <xs:element name="METADATEN">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="DATUM"/>
                        <xs:element ref="TITEL" maxOccurs="unbounded"/>
                        <xs:element ref="KEYWORD" maxOccurs="unbounded"/>
                        <xs:element ref="AUTOR-ID"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="TITEL" type="xs:string"/>
    </xs:schema>
    2. problem: hier i have no idea what is happening ... please help
    java.sql.SQLException: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00004: internal error "MultiChar overflow"
    Error at line 61
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
         at test.insertXML(test.java:53)
         at test.main(test.java:259)

    It's hard for me to tell you more without seeing your instance data, but for problem #1, if you look at the underlying SQL types being generated by your schema, you will see that the default SQL mapping for a "string" in your schema is a VARCHAR2(4000) (and I believe this would be only 2000 for a varying width character set like UTF8).
    You can specify that you wish this column to be mapped as a CLOB in your schema if this is the problem. Also note that there is a 64K limit on the size of an individual node in XMLType.

  • How to read data with different XML schemas within the single connection?

    I have Oracle 11g database
    I access it through jdbc:oracle:thin, version 11.2.0.3, same as xdb.
    I have several tables, each has one XMLType column, all schema-based.
    There are three different XML schemata registered in the DB
    I may need to read the XML data from several tables.
    If all the XMLTypes have the same XML schema ,there is no problem,
    If the schemata are different, the second read throws BindXMLException.
    If I reset the connection between the reads of the XMLType column with different schemata, it works.
    The question is: how can I configure the driver, or the connection to be able to read the data with different XML schemata without resetting the connection (which is expensive).
    The code to get the XMLType data is textbook implementation:
    1   ResultSet resultSet = statement.executeQuery( sql ) ;
    2   String result = null ;
    3    while(resultSet.next()) {
    4   SQLXML sqlxml = resultSet.getSQLXML(1) ;
    5   result = sqlxml.getString() ;
    6   sqlxml.free();
    7   }
    8   resultSet.close();
    9    return result ;

    It turns out, that I needed to serialize the XML on the server and read it as Blob. Like this:
    1    final Statement statement = connection.createStatement() ;
    2    final String sql = String.format("select xmlserialize(content xml_content_column as blob encoding 'UTF-8') from %s where key='%s'", table, key ) ;
    3   ResultSet resultSet = statement.executeQuery( sql ) ;
    4   String result = null ;
    5    while(resultSet.next()) {
    6   Blob blob = resultSet.getBlob( 1 );
    7   InputStream inputStream = blob.getBinaryStream();
    8   result = new Scanner( inputStream ).useDelimiter( "\\A" ).next();
    9   inputStream.close();
    10   blob.free();
    11   }
    12   resultSet.close();
    13   statement.close();
    14
    15   System.out.println( result );
    16    return result ;
    17
    Then it works. Still, can't get it work with XMLType in resultset.On the client unwrapping XML blows up when trying to switch to different XML schema. JDBC/XDB problem?

  • Updating registered XML Schema

    We're going to use Oracle XML DB (Oracle 9.2.0.5). We will register our XML Schema files to Oracle. In case we later want to update one of the registered schemas I tested updating some example schemas.
    I found a thread here in the forum with some steps to update a registered schema we:
    forum
    >
    For each table or column based on the schema
    1. Create a table with a column of XMLType which is not based on the
    XMLSchema. EG XMLType stored as CLOB
    2. Copy the content of the existing table into the CLOB based table.
    3. Delete the existing schema
    4. REgister the New Schema.
    5. Recreate teh tables and columns
    6. COpy the data into the new tables using supplied XSL transformation where
    necessary
    7. Delete tempoarary tables....
    I followed the steps and it works.
    But there is one thing I want to know:
    I have a schema A and a schema B and I want to use definitions of schema B in schema A, using the <import> element. Now I want to update schema B. When i follow the steps above i have to backup all tables/coloumns which contain elements defined in schema B. Then i delete the schema and reregister it. When trying to query data in schema A i get an error message: ORA-04045: errors during recompilation/revalidation. This is even if i reregister the previous schema with annotations.
    For now i have to delete schema A too and reregister schema A and B. Is there a way to only update a single schema without affecting the schemas using definitions of this schema?
    Imagine i use a library schema with a lot of type definitions and other schemas import this schema because they need to use some of these types, then i have to update/reregister all the schemas. So any suggestions are welcomed.

    Please check if this helps:
    http://www.oracle.com/technology/oramag/oracle/03-jul/o43xml.html

  • XML schema changes

    Hi,
    Can someone tell me whats the best way to handle XML schema changes if there are already XMLType tables creates using the schema?
    I checked the Oracle XML DB developer's guide but didnt find any information on updating schema.
    Thanks,
    Hiren

    Fundamentally the process behind copyEvolve is...
    For each table or column based on the schema
    1. Create a table with a column of XMLType which is not based on the XMLSchema. EG XMLType stored as CLOB
    2. Copy the content of the existing table into the CLOB based table.
    3. Delete the existing schema
    4. REgister the New Schema.
    5. Recreate teh tables and columns
    6. COpy the data into the new tables using supplied XSL transformation where necessary
    7. Delete tempoarary tables....
    The manual schema evoluiton method outlined in the 10g XML DB documentation will work in 9.2.x. The copyEvolve() method is only available in 10g. It should be noted that we do cheat a little under the covers with the copyEvolve() process, so in general, in 10g using copyEvolve() will be a little faster than the above process.
    THe other thing related to using the repository. We carefully preserve any OID's related to the XMLType tables affected by this process so that all the repository references remain valid.

  • How to rename element (node) names in an XMLType column?

    I have a source table with a xml data stored in an XMLType column.
    The xml contains elements/nodes identified by numbers. I need to replace the numbers with the appropriate names.
    The plsql below does this, but has two issues:
    i. It selects the data into a clob and does a text replace on the elements in a loop. This works, but is super slow for 3500+ xml rows (about 500 node pairs per row).
    ii. Once the data has had the element numbers replaced with the names, it inserts the new xml (clob wrapped in xmltype function) into the table with the XMLType attribute.
    The problem with the latter action is that it is failing due to nls client vs server settings, or so it appears from what I could dig up. The actual error message:
    ORA-19202: Error occurred in XML processing
    LPX-00242: invalid use of ampersand ('&') character (use &amp;)
    Error at line 3
    There are come entities in the original xml like "&#61616;" (the degree symbol).
    My question is two-fold:
    a). Can I replace the element names without straying from the xmltype datatype? If so, how?
    b). If I cannot do "a.)", then what must I do ensure that the clob gets converted correctly to xmltype and inserted into the table?
    SQL> select <some rows> from nls_database_parameters ;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CHARACTERSET WE8ISO8859P1
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_RDBMS_VERSION 10.2.0.1.0
    SQL> SELECT * FROM NLS_SESSION_PARAMETERS;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    ----code below-----
    (note, this is a stripped down version of the original, so there may be typos)
    declare
    l_xmlclob CLOB;
    l_newxml XMLType;
    v_record_uid NUMBER(20);
    CURSOR my_cur IS
    select a.elementname,b.tagname
    from t_elements a, t_tags b
    where (a.element_uid = b.element_uid)
    begin
    select br.xml_data.getClobVal() xml_data into l_xmlclob from t_elements;
    FOR my_rec IN my_cur LOOP
    l_xmlclob := replace(l_xmlclob,my_cur.elementname,my_cur.maptag_name);
    END LOOP;
    l_newxml := XMLType(l_xmlclob);
    insert into test_translated_xml (xml_data) values (l_newxml);
    end;
    (hopefully I haven't missed anything)
    Any tips or hints would be much appreciated.
    Thanks!

    Hello again,
    Take a look at html entity codes: http://www.w3schools.com/tags/ref_entities.asp.
    You can use this:
    insert into t values (xmltype('<test>'||dbms_xmlgen.convert('this is a test &')||'deg;</test>'));
    or
    insert into t values (xmltype('<test>'||dbms_xmlgen.convert('this is a test &')||'#176;</test>'));
    see this: &deg; (& deg;) or this: &#176; (& #176;)
    SQL*Plus will not display degree character. But this is valid enitity code, and when you generate HTML out of this, it should be displayed properly in web browser.
    HTML is in fact XML, that is validated by specific DTD (Document Type Definition).
    Paweł

  • XML Schema causing an ORA-00600 error

    Hi,
    I have an xml schema that generates an ORA-00600 error when I try to create a table containing an XMLType column that references the schema.
    Here's an extract from my xmlschema with the offending bit in bold:
    <xs:simpleType name="PrintIndicator">
              <xs:restriction base="xs:string">
                   <xs:length value="1"/>
                   <xs:enumeration value="0"/>
                   <xs:enumeration value="1"/>
                   <xs:enumeration value="2"/>
                   <xs:enumeration value="3"/>
                   <xs:enumeration value="4"/>
                   <xs:enumeration value="5"/>
              </xs:restriction>
         </xs:simpleType>
    <xs:complexType name="ISCDBankOffices">
              <xs:sequence>
                   <xs:element name="BankOfficeTitle" type="BACS:BankOfficeTitle"/>
                   <xs:element name="PrintIndicator">
                        <xs:simpleType>
                             <xs:restriction base="BACS:PrintIndicator"/>                    </xs:simpleType>
                   </xs:element>
              </xs:sequence>
    </xs:complexType>
    Does anyone know why this causes Oracle a problem. The schema originates from an external third-party so I can't easily change it.
    Thanks
    John

    Problem seems to be the colon in the type name.
    <xs:simpleType name="PrintIndicator">
    <xs:restriction base="xs:string">
    <xs:length value="1"/>
    <xs:enumeration value="0"/>
    <xs:enumeration value="1"/>
    <xs:enumeration value="2"/>
    <xs:enumeration value="3"/>
    <xs:enumeration value="4"/>
    <xs:enumeration value="5"/>
    </xs:restriction>
    </xs:simpleType>
    <xs:complexType name="ISCDBankOffices">
    <xs:sequence>
    <xs:element name="BankOfficeTitle" type="BACSBankOfficeTitle"/>
    <xs:element name="PrintIndicator">
    <xs:simpleType>
    <xs:restriction base="BACSPrintIndicator"/> </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    try this one. I removed the colons.
    Normally column names in Oracle cannot have such special characters.
    Hope This helps.

  • Conditions in XML schema

    Hello all
    This is more of a XML schema design question.
    If I have 2 elements, both at the same hierarchy level in a xml document, how can I enforce a condition such that atleast one of these elements should occur ? I don't think choice, all or sequence would do it for me!!
    Thanks for your replies.
    Mahesh :)

    Hey
    Thanks a lot. I knew it would be simple.
    One more question I have-
    I am trying to convert a fixed length flat file to XML.
    I believe the only required information for such a coversion is- the element or field names, their data types, and the fixed length of each field.
    I do not want to generate a xsl document by hand. Just looking if there are any open source tools which can help me out here.
    Thanks a bunch
    Mahesh :)

Maybe you are looking for