XMLType column selection

I have the following in an XMLType column:
<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040" />
<templateId root="2.16.840.1.113883.10.20.1" />
<id root="2.16.840.1.113883.3.140.1.0.6.1" extension="7380300531250060" />
<code code="34133-9" displayName="Summarization of episode note" codeSystem="2.16.840.1.113883.6.1" />
<title>Madison Medical Center P. A. Continuity of Care Document</title>
<effectiveTime value="20090508115140-0400" />
<confidentialityCode code="N" displayName="Normal" codeSystem="2.16.840.1.113883.5.25" />
<languageCode code="en-US" />
<recordTarget>
<patientRole>
<id root="2.16.840.1.113883.3.140.1.0.6.4" extension="10" />
<id root="2.16.840.1.113883.4.1" extension="345003434" />
<addr>
<streetAddressLine>3456 West Palm</streetAddressLine>
<streetAddressLine>Apt. #34</streetAddressLine>
<city>Madison</city>
<state>CA</state>
<postalCode>95653</postalCode>
</addr>
<telecom use="HP" value="tel:(916) 555-3293" />
<telecom value="mailto:[email protected]" />
<patient>
<name>
<given>FirstName</given>
<given>W</given>
<family>LastName</family>
</name>
<administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1" codeSystemName="AdministrativeGender" />
<birthTime value="19380816" />
<maritalStatusCode code="M" displayName="Married" codeSystem="2.16.840.1.113883.11.12212" codeSystemName="MaritalStatus" />
<raceCode code="2106-3" displayName="White" codeSystem="2.16.840.1.113883.11.14914" codeSystemName="Race" />
</patient>
</ClinicalDocument>
When I run select extractvalue(CCD_DOC, 'recordTarget/patientRole/patient/name/family') from CCD; no errors are returned but I also don't get the value. What am I missing?

In a word - namespace definitions...
Here's an example written using XMLQuery, rather than extractValue, which is the preferred approach in 10.2.x and later...
SQL> with CCD as
  2  (
  3  select XMLTYPE(
  4  '<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  5     <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
  6     <templateId root="2.16.840.1.113883.10.20.1"/>
  7     <id root="2.16.840.1.113883.3.140.1.0.6.1" extension="7380300531250060"/>
  8     <code code="34133-9" displayName="Summarization of episode note" codeSystem="2.16.840.1.113883.6.1"/>
  9     <title>Madison Medical Center P. A. Continuity of Care Document</title>
10     <effectiveTime value="20090508115140-0400"/>
11     <confidentialityCode code="N" displayName="Normal" codeSystem="2.16.840.1.113883.5.25"/>
12     <languageCode code="en-US"/>
13     <recordTarget>
14             <patientRole>
15                     <id root="2.16.840.1.113883.3.140.1.0.6.4" extension="10"/>
16                     <id root="2.16.840.1.113883.4.1" extension="345003434"/>
17                     <addr>
18                             <streetAddressLine>3456 West Palm</streetAddressLine>
19                             <streetAddressLine>Apt. #34</streetAddressLine>
20                             <city>Madison</city>
21                             <state>CA</state>
22                             <postalCode>95653</postalCode>
23                     </addr>
24                     <telecom use="HP" value="tel:(916) 555-3293"/>
25                     <telecom value="mailto:[email protected]"/>
26                     <patient>
27                             <name>
28                                     <given>FirstName</given>
29                                     <given>W</given>
30                                     <family>LastName</family>
31                             </name>
32                             <administrativeGenderCode code="M" codeSystem="2.16.840.1.113883.5.1" codeSystemName="AdministrativeGender"/>
33                             <birthTime value="19380816"/>
34                             <maritalStatusCode code="M" displayName="Married" codeSystem="2.16.840.1.113883.11.12212" codeSystemName="MaritalStatus"/>
35                             <raceCode code="2106-3" displayName="White" codeSystem="2.16.840.1.113883.11.14914" codeSystemName="Race"/>
36                     </patient>
37             </patientRole>
38     </recordTarget>
39  </ClinicalDocument>') as CCD_DOC from dual
40  )
41  select XMLCAST
42         (
43           XMLQUERY
44           (
45              'declare default element namespace  "urn:hl7-org:v3"; (: :)
46               declare namespace voc = "urn:hl7-org:v3/voc"; (: :)
47               $doc/ClinicalDocument/recordTarget/patientRole/patient/name/family'
48               passing CCD_DOC as "doc"
49               returning content
50           )
51           as VARCHAR2(4000)
52         )
53    from CCD
54  /
XMLCAST(XMLQUERY('DECLAREDEFAULTELEMENTNAMESPACE"URN:HL7-ORG:V3";(::)DECLARENAME
LastName
SQL>

Similar Messages

  • Convert CLOB to XMLType in SELECT statement ?

    Hi XML Xperts,
    In my Oracle 9.2.0.3 I have 1 table (tab1) with 2 cols (col1 as XMLType and col2 as CLOB). I Inserted in both fields the following same XML data :
    <?xml version="1.0"?>
    <TABLE_NAME>MY_TABLE</TABLE_NAME>
    With the following statement, I can get the data from col1 which is a XMLType column :
    SELECT a.col1.extract('//TABLE_NAME/text()').getStringVal() AS "Table Name"
    FROM tab1 a
    WHERE a.col1.existsNode('/TABLE_NAME') = 1;
    How to get the same data FROM col2 whcih is a CLOB column ? Is it possible to transform the CLOB to XMLType in the SELECT statement ?
    Note : I cannot change the type of the colulmn col2 to XMLType
    Thanks in advance.
    Phil

    I tested it in 10g and it seems to be OK.
    create table clobtoxml(xmldata clob);
    insert into clobtoxml
    values('<RootE><FirstNode>This is CLOB data to XML</FirstNode></RootE>');
    commit;
    select sys.xmltype(xmldata).extract('/RootE/FirstNode/text()').getStringVal() from clobtoxml;
    This is CLOB data to XML
    select sys.xmltype(xmldata).extract('/*') from clobtoxml;
    <RootE>
    <FirstNode>This is CLOB data to XML</FirstNode>
    </RootE>
    Ben

  • Select DISTINCT attribute vlaues fom XMLTYPE column and...

    Hello
    I have spent whole day to find the solution with no success. PLEAS HELP !
    The Problem :
    1. I have table with xmlType column in this column is the following xml:
    <revision>
    <product id = 1>
    <screw>
    <img id = 1/>
    </screw>
    <screw>
    <img id = 2/>
    </screw>
    </product>
    <product id = 2>
    <screw>
    <img id = 1/>
    </screw>
    </product>
    </revision>
    I must select DISTINCT img IDs and then select/join them form relational table img (id(number), pic (blob) )
    I can't find the solution to select distinct attribute values from XML!
    I have tried this:
    select extract(c.xml, 'revision/product/screw/img[not(@id=preceding-sibling::img/@id)]/@id') from TABLE c;

    Hello Odie_63
    I have again problem finally my XML looks that:
    <revision>
    <product id = "1">
    <screw>
    <img id = "1"/>
    </screw>
    <component>
    <img id = "1"/>
    </component>
    <screw>
    <img id = "2"/>
    </screw>
    <component>
    <img id = "2"/>
    </component>
    </product>
    <product id = "2">
    <screw>
    <img id = "1"/>
    </screw>
    <component>
    <img id = "4"/>
    </component>
    </product>
    </revision>'));
    And I don't know why my following statement doesn't work. (I must slect all distinct id from <img>).
    select distinct x.img_id
    from cfg_xml t
    , xmltable(
    '/revision/definitions/product'
    passing T.EQ_CFG_XML
    columns img_id number path '/component/img/@id',
    img_id2 number path '/screw/img/@id'
    ) x
    And this is VERY SLOW :/
    select x.img_id, y.img_id
    from cfg_xml t
    , xmltable(
    '/revision/definitions/product/screw/img'
    passing T.EQ_CFG_XML
    columns img_id number path '@id'
    ) x,
    xmltable(
    '/revision/definitions/product/component/img'
    passing T.EQ_CFG_XML
    columns img_id number path '@id'
    ) y
    Is it possible to return al distinct ID in one column>?
    Thanks for HELP :)
    Edited by: kozand on 2011-06-29 07:50

  • Issues with selecting value from XMLType column

    I want to retrieve values from my XMLType column. Can anyone tell me why this works
    select XMLCAST
                XMLQUERY
                   'declare default element namespace  "urn:hl7-org:v3"; (: :)
                    declare namespace voc = "urn:hl7-org:v3/voc"; (: :)
                    $doc/ClinicalDocument/recordTarget/patientRole/patient/name/family'
                    passing CCD_DOC as "doc"
                    returning content
                as VARCHAR2(4000)
         from CCDbut this doesn't?
    select
        ccdid,
        extractvalue(CCD_DOC,'/recordTarget/patientRole/patient/name/given') "given",
        extractvalue(CCD_DOC,'/recordTarget/patientRole/patient/name/family') "family",
        extractvalue(CCD_DOC,'/recordTarget/patientRole/providerOranization/name') "name",
        extractvalue(CCD_DOC, 'title') as Title
    from CCDwhere ClinicalDocument is the root element?
    I don't get any errors from the second one but the three XML-derived columns are null. The values are not retrieved while the values ARE retrieved using the first method.
    Thanks!

    XMLTable..
    select x.*
      from CCD,
           XMLTable
             xmlNamespaces
               default 'urn:hl7-org:v3',
               'urn:hl7-org:v3/voc' as "voc"
             '$doc/ClinicalDocument/recordTarget/patientRole'
             passing CCD_DOD as "doc"
             columns
             given varchar2(128) path 'patient/name/given',
             family varchar2(128) path 'patient/name/family',
             name varchar2(128) path 'providerOranization/name'
           ) x

  • OO4O, OCI-21560 when selecting records with XMLTYPE column

    When I try to select records from a table with XMLTYPE column
    Set sqldynaset = oraDatabase.dbcreatedynaset("select * from tab1",
    ORADYN_READONLY)
    I got the error message:
    OCI-21560: argument 3 is null, invalid, or out of range.
    Please help.
    Development Tool: VB6
    Oracle Client Version (OIP) : 9.2.0.4.4
    Platform: Window XP

    OO4O doesn' t understand XMLType.

  • The simplest way to get more performance on select on xmltype column?

    We have a table with xmltype column:
    CREATE TABLE "TK"."PLAN_2" ("UNID" NUMBER NOT
    NULL,
    "XMLSTRING" "TK"."XMLTYPE",
    CONSTRAINT "SYS_C001142583" PRIMARY KEY("UNID")
    USING INDEX
    TABLESPACE "TX"
    STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
    2147483645 PCTINCREASE 0) PCTFREE 10 INITRANS 2 MAXTRANS 255)
    The data in column xmlstring looks like this:
    <Agent>
    <OP End="2520000" Id="001_8232_0_91" Origin="Autos" Quantity="1.0 ea" Start="2520000">
    <OSP Key="ADM_ID" String="001_8232_0" />
    <OSP Key="AddAutoNr" String="0" />
    <OSP Key="CURRENT_STATE" String="Tages-Vorgabe" />
    <OLP Key="ChUser">
    <OIP Key="(T_SP) test2" Long="1218125408541" />
    <OIP Key="(T_SP) admin" Long="1219071385346" />
    <OIP Key="(T_SP) test2" Long="1237540381906" />
    </OLP>
    <OSP Key="Debicode" String="9903" />
    <OSP Key="Resource" String="SBN" />
    <OSP Key="TrafficDay" String="91" />
    <OSP Key="AutoNrSchema" String="001" />
    <OSP Key="AutoNumber" String="8232" />
    <OPE End="0" Id="Prod" Origin="Autos|Prod" Start="0">
    <OProd Duration="0" End="0" Id="Produce" OriginDirect="Autos|Prod|Produce" Quantity="1.0 ea" Start="0" Type="Produce">
    <OSP Key="RESelection.Parameter" String="Resource" />
    <Resource Id="Autos" />
    <Alloc From="OP|001_8232_0_91|Prod|Produce" Id="" Quantity="1.0 ea" To="CO|001_8232_0_91|001_8232_0_91" Type="PRODUCEREQ_TO_CONSUMEREQ" />
    </OProd>
    </OPE>
    <OPE End="2520000" Id="Step_0" Origin="Autos|Step" Start="0">
    <OQP Key="Delay" Overridden="true" Quantity="0.0 s" />
    <OQP Key="Distance" Quantity="44.84 km" />
    <OQP Key="Duration" Quantity="2520.0 s" />
    <OQP Key="Fahrt" Quantity="2520.0 s" />
    <OSP Key="From" String="BS" />
    <OSP Key="I1" String="0" />
    <OSP Key="PLACE" String="1" />
    <OQP Key="StartDelay" Overridden="true" Quantity="0.0 s" />
    <OQP Key="TWait" Overridden="true" Quantity="0.0 s" />
    <OSP Key="To" String="OL" />
    <OUse Duration="2520000" End="2520000" Id="LStep_0" Name="L" OriginDirect="Autos|Step|LStep" Quantity="1.0 ea" Start="0" Type="Step">
    <OSP Key="I2" String="0" />
    <OIP Key="LPOSITION" Long="1" Overridden="true" />
    <OSP Key="PLACE" String="1" />
    <OQP Key="Wait" Overridden="true" Quantity="0.0 s" />
    <Resource Id="vs_RABe525_13" />
    </OUse>
    <OUse Duration="480000" End="0" Id="LPre_0" Name="L" OriginDirect="Autos|Step|LPre" Quantity="1.0 ea" Start="-480000" Type="Pre">
    <OQP Key="Fahrbereit" Overridden="true" Quantity="2 min" />
    <OSP Key="From" Overridden="true" String="BS" />
    <OSP Key="I2" String="0" />
    <OSP Key="PLACE" String="1" />
    <OSP Key="StepIndex" String="0" />
    <OSP Key="To" Overridden="true" String="BS" />
    <OQP Key="Vorbereitung" Overridden="true" Quantity="6 min" />
    <Resource Id="vs_RABe525_13" />
    </OUse>
    <OUse Duration="600000" End="3120000" Id="LPost_0" Name="L" OriginDirect="Autos|Step|LPost" Quantity="1.0 ea" Start="2520000" Type="Post">
    <OQP Key="Abstellzeit" Overridden="true" Quantity="4 min" />
    <OSP Key="From" Overridden="true" String="OL" />
    <OSP Key="I2" String="0" />
    <OQP Key="Nachbereitung" Overridden="true" Quantity="6 min" />
    <OSP Key="PLACE" String="1" />
    <OSP Key="StepIndex" String="0" />
    <OSP Key="To" Overridden="true" String="OL" />
    <Resource Id="vs_RABe525_13" />
    </OUse>
    <OUse Duration="2520000" End="2520000" Id="FStep_0" Name="F" OriginDirect="Autos|Step|FStep" Quantity="1.0 ea" Start="0" Type="Step">
    <OSP Key="I2" String="0" />
    <OSP Key="PLACE" String="1" />
    <OQP Key="Wait" Overridden="true" Quantity="0.0 s" />
    <Resource Id="ps_P112" />
    </OUse>
    <OUse Duration="480000" End="0" Id="FPre_0" Name="F" OriginDirect="Autos|Step|FPre" Quantity="1.0 ea" Start="-480000" Type="Pre">
    <OQP Key="Fahrbereit" Overridden="true" Quantity="2 min" />
    <OSP Key="From" Overridden="true" String="BS" />
    <OSP Key="I2" String="0" />
    <OSP Key="PLACE" String="1" />
    <OSP Key="StepIndex" String="0" />
    <OQP Key="Taxi" Overridden="true" Quantity="0 s" />
    <OSP Key="To" Overridden="true" String="BS" />
    <OQP Key="Vorbereitung" O verridden="true" Quantity="6 min" />
    <OQP Key="Wegzeit" Overridden="true" Quantity="0 s" />
    <Resource Id="ps_P112" />
    </OUse>
    <OUse Duration="600000" End="3120000" Id="FPost_0" Name="F" OriginDirect="Autos|Step|FPost" Quantity="1.0 ea" Start="2520000" Type="Post">
    <OQP Key="Abstellzeit" Overridden="true" Quantity="4 min" />
    <OSP Key="From" Overridden="true" String="OL" />
    <OSP Key="I2" String="0" />
    <OQP Key="Nachbereitung" Overridden="true" Quantity="6 min" />
    <OSP Key="PLACE" String="1" />
    <OSP Key="StepIndex" String="0" />
    <OQP Key="Taxi" Overridden="true" Quantity="0 s" />
    <OSP Key="To" Overridden="true" String="OL" />
    <OQP Key="Wegzeit" Overridden="true" Quantity="0 s" />
    <Resource Id="ps_P112" />
    </OUse>
    </OPE>
    </OP>
    </Agent>
    We try to select:
    SELECT UNID, extractValue(value(OUSE_XMLSTRING), '/OUse/Resource/@Id') OUSE_RESOURCE,
    extract(XMLSTRING, '/Agent/OP/OSP[@Key = "TrafficDay"]/@String') TT_DAY,
    extract(XMLSTRING, '/Agent/OP/@Start') OP_START,
    extract(XMLSTRING, '/Agent/OP/@End') OP_END,
    extract(XMLSTRING, '/Agent/OP/OSP[@Key = "ADM_ID"]/@String') ADM_ID,
    extractValue(value(OUSE_XMLSTRING), '/OUse/@Start') OUSE_START,
    extractValue(value(OUSE_XMLSTRING), '/OUse/@End') OUSE_END
    FROM tk.plan_2, table(XMLSequence(extract(XMLSTRING, '//Agent/OP//OPE//OUse'))) OUSE_XMLSTRING
    where extractValue(value(OUSE_XMLSTRING), '/OUse/Resource/@Id') = 'vs_RABe525_13';
    with this explain plan:
    PLAN_TABLE_OUTPUT
    Plan hash value: 3476314316
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 101 | 22018 | 31 (0)| 00:00:01 |
    | 1 | NESTED LOOPS | | 101 | 22018 | 31 (0)| 00:00:01 |
    | 2 | TABLE ACCESS FULL | PLAN_2 | 2 | 432 | 2 (0)| 00:00:01 |
    |* 3 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
    Predicate Information (identified by operation id):
    3 - filter(EXTRACTVALUE(VALUE(KOKBF$),'/OUse/Resource/@Id')='vs_RABe525_13')
    We want to select on the 'ID', which occurs more than once in the xmlstring and the table gonna be big, so we think we need some kind of index on the ID-Identifier. What will be the best way to do this?

    Which version of Oracle (4 digits)?
    If 10.2 or greater, look into using XMLTable and that is the replacement for the table(XMLSequence(extract()) approach. Also, avoid the use of // unless you really need it. I doubt it will make a difference in your situation but just a good performance approach in general.
    We want to select on the 'ID', which occurs more than once in the xmlstringI assume you are going to want the count(...) > 1 from the XML to tell you which you are selecting?
    I also have questions about what that XMLType is being stored as but that depends upon what your version is regarding what storage options you have.
    Edited by: A_Non on Jun 7, 2010 10:55 AM
    Forgot to add, look in the FAQ (under your sign-in name on the upper right) for how to use the tag to better format your posts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Help on how to query 11g table with XMLType column

    To all,
    We have this table:
    DESC MESSAGE
    Name Null Type
    MESSAGE_ID NOT NULL NUMBER(38)
    REQUEST_UU_ID NOT NULL VARCHAR2(50)
    MESSAGE_TYPE_CD NOT NULL CHAR(3 CHAR)
    EMPLOYEE_NUM NOT NULL VARCHAR2(8)
    SEQUENCE_NUM VARCHAR2(20)
    REVERSAL_SEQUENCE_NUM VARCHAR2(20)
    TRANSACTION_TS TIMESTAMP(6)
    MESSAGE_CONTENT_TXT NOT NULL XMLTYPE()
    CREATE_BY_NM NOT NULL VARCHAR2(50 CHAR)
    CREATE_BY_TS NOT NULL TIMESTAMP(6)
    LAST_UPDATE_BY_NM NOT NULL VARCHAR2(50 CHAR)
    LAST_UPDATE_BY_TS NOT NULL TIMESTAMP(6)
    Given we have multiple columns and one is XMLType how do I query to find rows in the db that match this XPath
    Here is a fragment of XML that is held in MESSAGE_CONTENT_TXT XMLType column:
    <?xml version="1.0" encoding="UTF-8"?>
    <cfg-env:Envelope xmlns="http://www.co.com/schemas/CFX/" xmlns:cfg-env="http://www.co.com/schemas/cfg-env/" xmlns:cfg-hdr="http://www.co.com/schemas/cfg-hdr/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.co.com/schemas/cfg-env/" >
         <cfg-env:Header>
              <cfg-hdr:MessageHeader xmlns:cfg-hdr="http://www.co.com/schemas/cfg-hdr/" xmlns:cfg-env="http://www.co.com/schemas/cfg-env/" xmlns="http://www.co.com/schemas/CFX/">
                   <cfg-hdr:Service>
                        <cfg-hdr:ServiceName>process</cfg-hdr:ServiceName>
                        <cfg-hdr:MessageType>Request</cfg-hdr:MessageType>
                        <cfg-hdr:ServiceVersion>1</cfg-hdr:ServiceVersion>
                   </cfg-hdr:Service>
                   <cfg-hdr:From>
                        <cfg-hdr:PartyId>13-175-8724</cfg-hdr:PartyId>
                        <cfg-hdr:CostCenter>2009065</cfg-hdr:CostCenter>
                        <cfg-hdr:System>
                             <cfg-hdr:Application>[email protected]</cfg-hdr:Application>
                             <cfg-hdr:Version>1.0</cfg-hdr:Version>
                             <cfg-hdr:Channel>TLR</cfg-hdr:Channel>
                        </cfg-hdr:System>
                        <cfg-hdr:OrigReplyToQMgr>QMBKRD01</cfg-hdr:OrigReplyToQMgr>
                        <cfg-hdr:OrigReplyToQ>Q1</cfg-hdr:OrigReplyToQ>
                   </cfg-hdr:From>
                   <cfg-hdr:UserSession>
                        <cfg-hdr:SignonRole>User</cfg-hdr:SignonRole>
                        <cfg-hdr:LogonId>R099999</cfg-hdr:LogonId>
    I'm trying to find rows in the database that are /Envelope/Header/MessageHeader/UserSession/LogonId/R099999.
    Thanks for the assistance. I'm new to XML DB. I appreciate the help.
    Eric

    Hi Eric,
    You can use XMLExists, like this :
    select *
    from message t
    where xmlexists(
          'declare namespace env = "http://www.co.com/schemas/cfg-env/"; (: :)
           declare namespace hdr = "http://www.co.com/schemas/cfg-hdr/"; (: :)
           /env:Envelope/env:Header/hdr:MessageHeader/hdr:UserSession[hdr:LogonId=$id]'
           passing t.message_content_txt
                 , 'R099999' as "id"
    );

  • 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 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ł

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

  • Ctxsys.context index on registered schema xmltype column

    9iR2
    Is it possible to create a text index (indextype is ctxsys.context) on a schema registered xmltype column?
    I tried it, the index creation works fine.
    After the first insert statement the Oracle process seems to hang. (CPU 100%, increasing memory consumption)

    Yes, I previously entered some data.
    Test case:
    1. register schema
    begin
    DBMS_XMLSCHEMA.REGISTERSCHEMA('http://localhost/JobPositionSeeker-1_1.xsd',
    getDocument('JobPositionSeeker-1_1.xsd'), TRUE, TRUE, FALSE, FALSE
    end;
    2. create table
    CREATE TABLE application_xml of XMLType
    XMLSCHEMA "http://localhost/JobPositionSeeker-1_1.xsd" ELEMENT "JobPositionSeeker"
    3. entered some data
    4. created the index
    create index applicant on application_xml ( SYS_NC_ROWINFO$)
    indextype is ctxsys.context
    5. select using index
    select value(a).getClobVal() from application_xml a
    where contains( value(a),'%ai% INPATH(//PersonalData/PersonName/FamilyName)')>0
    6. insert another record
    -> crash

  • Permission issues accross schemas to load XMLTYPE column - structured storage

    Hi,
    We have a table in BIUSER schema this table is object-realtionally stored with XMLs. When we are trying to load receords from ETLUSER schema we are getting the error as
    Record 1: Rejected - Error on table "BIUSER"."PWAYWORKFILE_TABLE".
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01031: insufficient privileges
    Heres the oracle installation details
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE 11.2.0.3.0 Production"
    All the records are moving to the bad file, whereas the same load happens normally in its own schema i.e. BIUSER
    Suspecting this as permission issues we have already given the permission to the table sysnonym as given below in the registration script.
    We googled and found few things about ACLs that we are not sure of , its that is the issue please let us know if this table can be created and loaded from different schema
    Heres the table creation and registration script
    set echo on
    spool regschema.log
    set define on
    set timing on
    set long 100000 pages 0 lines 256 trimspool on timing on
    drop table PWAYWORKFILE_TABLE;
    drop sequence PWAYWORKFILE_TABLE_SEQ;
    begin
    dbms_xmlschema.deleteschema('workfile.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('TotalLoss.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('Salvage.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('rate.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('notes.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('Image.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('Event.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('estimate.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('CoTotals.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('corr.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('Admin.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('Vins.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('commonType.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'commonType.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'commonType.xsd';
    BEGIN
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'Admin.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'Admin.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'CoTotals.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'CoTotals.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'Event.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'Event.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'Image.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'Image.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'Salvage.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'Salvage.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'TotalLoss.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'TotalLoss.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME        VARCHAR2(700) := 'Vins.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'Vins.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      -- DOM Fidelity enabled due to presence of mixed text, substitution group heads, or repeating choice structures in complex type defintion :-
      DBMS_XMLSCHEMA_ANNOTATE.enableMaintainDOM(V_XML_SCHEMA,'RefurbMgr',TRUE);
      select /*+ NO_XML_QUERY_REWRITE */
             XMLQuery(
               'declare namespace xdb = "http://xmlns.oracle.com/xdb"; (:
                copy $NEWSCH := $SCHEMA modify (
                                          let $MODEL := $NEWSCH/xs:schema/xs:complexType[11]/xs:all
                                          return (
                                            replace value of node $MODEL/xs:element[2]/xs:complexType/@xdb:maintainDOM with "false",
                                            replace value of node $MODEL/xs:element[3]/xs:complexType/@xdb:maintainDOM with "false",
                                            replace value of node $MODEL/xs:element[4]/xs:complexType/@xdb:maintainDOM with "false"
                 return $NEWSCH'
               passing V_XML_SCHEMA as "SCHEMA"
               returning content
        into V_XML_SCHEMA
        from dual;
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'corr.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'corr.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'estimate.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'estimate.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'notes.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'notes.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'rate.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'rate.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'workfile.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'workfile.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
      -- Out-of-Line mappings for 1000 Column optimization :-
      DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'AdminComp','ADMINCOMP_XML');
      DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'NotesComp','NOTESCOMP_XML');
      DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'SalvageComp','SALVGCOMP_XML');
      DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'CorrComp','CORRCOMP_XML');
      DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'ImageComp','IMAGECOMP_XML');
      DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'EventInterfaceManagerComp','EVIFCMGRCOMP_XML');
      DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'TotalLossComp','TOTALLOSSCOMP_XML');
      DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => TRUE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    -- Table creation for namespace "http://www.cccis.com/Pathways/Workfile"
    set lines 80
    CREATE TABLE "PWAYWORKFILE_TABLE"
          SequenceID NUMBER,
          DL_CLM_FOLDER_ID   VARCHAR2(30),
          CUST_CLM_REF_ID VARCHAR(25),
          ems_file_nm               varchar2(256),
          EST_IND         VARCHAR2(3),
          rec_dt date default sysdate,
          filesent_datetime date,
          CLM_TYP_CD               VARCHAR2(2 CHAR),
          WORKFILE  XMLTYPE
    XMLTYPE COLUMN WORKFILE
    STORE AS OBJECT RELATIONAL
    XMLSCHEMA "workfile.xsd" ELEMENT "PwayWorkfile"
    create sequence PWAYWORKFILE_TABLE_SEQ
    start with 1
    increment by 1
    nomaxvalue
    create trigger PWAYWORKFILE_TABLE_TRIGGER
    before insert on PWAYWORKFILE_TABLE
    for each row
    begin
    select PWAYWORKFILE_TABLE_SEQ.nextval into :new.SequenceID from dual;
    end;
    desc PWAYWORKFILE_TABLE
    /* create synonym */
    create or replace public synonym PWAYWORKFILE_TABLE for PWAYWORKFILE_TABLE;
    grant select on PWAYWORKFILE_TABLE to BIUSER_RO;
    grant select, insert, update,delete on PWAYWORKFILE_TABLE to biuser_full;
    exit;
    Regards,
    Arghyadip

    Hi MarcoGralike,
    I have finally acquired a sample schema and xmls to reproduce the errors that i am getting even after acquiring XDBADMIN privilege and registering my schema as GLOBAL.
    Here's the problem i am facing, whenever i intend to store the PublisherList (publisher.xsd) out of line while registration i am running into insufficient privilege issues even if i have the schema registered using (LOCAL => FALSE), whereas it runs smooth in BIUSER and if i dont set it out of line it works in ETLUSER as well.
    Here are the 2 XSD files
    books.xsd   --- this is the root element
    <xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb"  version="1.0" xdb:storeVarrayAsTable="true">
      <xs:include schemaLocation="publisher.xsd"/>
      <xs:element name="books" type="bookType"/>
      <xs:complexType name="bookType" abstract="true">
        <xs:sequence>
        <xs:element name="author" type="xs:string" minOccurs="0"/>
        <xs:element name="title" type="xs:string" minOccurs="0"/>
        <xs:element name="genre" type="xs:string" minOccurs="0"/>
        <xs:element ref="PublisherList" minOccurs="0"/>
       </xs:sequence>
       </xs:complexType>
    </xs:schema>
    publisher.xsd -- this is a child elelment which in my actual scenario is so big that i must keep it out of line during registration
    <xs:schema  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb"  version="1.0" xdb:storeVarrayAsTable="true">
      <xs:element name="PublisherList" type="PublisherListType"/>
      <xs:complexType name="PublisherListType">
        <xs:sequence>
        <xs:element name="Name" type="xs:string" minOccurs="0"/>
        <xs:element name="Office" type="xs:string" minOccurs="0"/>
       </xs:sequence>
       </xs:complexType>
    </xs:schema>
    Here's the sample XML
    <?xml version="1.0"?>
    <books xmlns:xs="http://www.w3.org/2001/XMLSchema">
          <author>Writer</author>
          <title>The First Book</title>
          <genre>Fiction</genre>
          <PublisherList>
           <Name>Penguin</Name>
           <Office>London</Office>
          </PublisherList>
    </books>
    Here's how i am registering the Schemas in BIUSER which has XDBADMIN privilege
    DROP TABLE BOOKS_TABLE;
    begin
    dbms_xmlschema.deleteschema('books.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    begin
    dbms_xmlschema.deleteschema('publisher.xsd',dbms_xmlschema.DELETE_CASCADE);
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'publisher.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'publisher.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
        DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => FALSE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    declare
      V_XML_SCHEMA_NAME       VARCHAR2(700) := 'books.xsd';
      V_XML_SCHEMA             XMLType       := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
      V_SCHEMA_LOCATION_HINT   VARCHAR2(700) := 'books.xsd';
    begin
      DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
      DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
      DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
    DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'bookType', 'PublisherList','PUBLISHERLIST_XML');
        DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL       => V_SCHEMA_LOCATION_HINT
       ,SCHEMADOC       => V_XML_SCHEMA
       ,LOCAL           => FALSE
       ,GENTYPES        => TRUE
       ,GENTABLES       => TRUE
       ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    end;
    CREATE TABLE BOOKS_TABLE
          BOOKS  XMLTYPE
    XMLTYPE COLUMN BOOKS
    STORE AS OBJECT RELATIONAL
    XMLSCHEMA "books.xsd" ELEMENT "books"
    DROP PUBLIC SYNONYM BOOKS_TABLE;
    create or replace public synonym BOOKS_TABLE for BOOKS_TABLE;
    grant select, insert, update,delete on BOOKS_TABLE to ETLUSER;
    Heres the ctl file that i am using
    Load_Books.ctl
    OPTIONS (ERRORS=100000, SILENT=(HEADER,FEEDBACK),ROWS=500, BINDSIZE=3072000 , READSIZE=3072000)
    load data
    infile '/apps/dev/PWXML-10/ctl/load_xml.txt'
    BADFILE '/apps/dev/PWXML-10/ctl/load_xml.txt.bad'
    DISCARDFILE '/apps/dev/PWXML-10/ctl/load_xml.txt.dsc'
    append
    into table BOOKS_TABLE
    filename filler char(120),
    BOOKS lobfile(filename) terminated by eof)
    '/apps/dev/PWXML-10/ctl/load_xml.txt' would contain the XML file path that i gave
    Heres how i am loading the XML through sqlldr in ETLUSER
    sqlldr etluser/etluserpassword@MYXMLDBNAME control=Load_Books.ctl log=Load_Books.ctl.log
    Here's the error i am getting
    Record 1: Rejected - Error on table "BIUSER"."BOOKS_TABLE".
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01031: insufficient privileges
    Hopefully i have given you all the set up required to pin point the evil error.
    Please let me know if i have missed something.

  • Problem reading a xmlType column (return only 999 rows) with XMLTable

    Hello,
    I'm new in the forum.
    Sorry for my english.
    I have a problem reading an xmltype column.
    My oracle's version is 11.1.0.6.0
    I have a table like this:
    Create Table TestXml (idProg number, xmldata XmlType)
    XMLTYPE COLUMN xmldata
    STORE AS BINARY XML;
    I have a xml file containing the equivalent of 10000 record (like a csv).
    my schema xsd is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:element name="applicazione">
              <xs:annotation>
                   <xs:documentation>Flusso Monitoraggi</xs:documentation>
              </xs:annotation>
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="periodo" maxOccurs="unbounded">
                             <xs:complexType>
                                  <xs:sequence>
                                       <xs:element name="segmento" maxOccurs="unbounded">
                                            <xs:complexType>
                                                 <xs:sequence>
                                                      <xs:element name="progressivo" maxOccurs="unbounded">
                                                           <xs:complexType>
                                                                <xs:sequence>
                                                                     <xs:element name="stato" type="xs:string"/>
                                                                     <xs:element name="ts_start" type="xs:string"/>
                                                                     <xs:element name="ts_stop" type="xs:string"/>
                                                                     <xs:element name="nota_esecuzione" type="xs:string"/>
                                                                     <xs:element name="ts_esecuzione" type="xs:string"/>
                                                                </xs:sequence>
                                                                <xs:attribute name="valore" type="xs:integer" use="required"/>
                                                           </xs:complexType>
                                                      </xs:element>
                                                 </xs:sequence>
                                                 <xs:attribute name="nome" type="xs:string" use="required"/>
                                            </xs:complexType>
                                       </xs:element>
                                  </xs:sequence>
                                  <xs:attribute name="nome" type="xs:string" use="required"/>
                             </xs:complexType>
                        </xs:element>
                   </xs:sequence>
                   <xs:attribute name="nome" type="xs:string"/>
              </xs:complexType>
         </xs:element>
    </xs:schema>
    When I try to read my xmltype column with this select :
    SELECT ap.desc_applicazione,pe.seq_periodo, pe.desc_elem_temp_ist,
    sg.desc_segmento_elab,pg.seq_progressivo,
    pg.desc_stato,pg.ts_start,pg.ts_stop,pg.nota_esecuzione,pg.ts_esecuzione,
    pg.valore_prog,sg.seq_segmento,idProg
    FROM testXML p,
    XMLTable('/applicazione' PASSING p.xmlData
    COLUMNS
    seq_applicazione for ordinality,
    desc_applicazione VARCHAR2(50) PATH '@nome',
    periodo XMLType PATH 'periodo') ap,
    XMLTable('periodo' PASSING ap.periodo
    COLUMNS
    seq_periodo for ordinality,
    desc_elem_temp_ist VARCHAR2(50) PATH '@nome',
    segmento XMLType PATH 'segmento') pe,
    XMLTable('segmento' PASSING pe.segmento
    COLUMNS
    seq_segmento for ordinality,
    desc_segmento_elab VARCHAR2(50) PATH '@nome',
    progressivo XMLTYPE PATH 'progressivo') sg,
    XMLTable('progressivo' PASSING sg.progressivo
    COLUMNS
    seq_progressivo for ordinality,
    valore_prog NUMBER PATH '@valore',
    desc_stato VARCHAR(10) PATH 'stato',
    ts_start VARCHAR2(50) PATH 'ts_start',
    ts_stop VARCHAR2(50) PATH 'ts_stop',
    nota_esecuzione VARCHAR2(50) PATH 'nota_esecuzione',
    ts_esecuzione VARCHAR2(50) PATH 'ts_esecuzione'
    ) pg
    where idProg = 1
    I obtained only 999 rows.
    I tried with two file xml, one containing 10000 repetition of progressivo, the other containing 10000 repetition of segmento.
    Anybody know why? Where is my error?
    Thank you in advance for any response.
    Maurizio

    Hello,
    I'm new in the forum.
    Sorry for my english.
    I have a problem reading an xmltype column.
    My oracle's version is 11.1.0.6.0
    I have a table like this:
    Create Table TestXml (idProg number, xmldata XmlType)
    XMLTYPE COLUMN xmldata
    STORE AS BINARY XML;
    I have a xml file containing the equivalent of 10000 record (like a csv).
    my schema xsd is the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:element name="applicazione">
              <xs:annotation>
                   <xs:documentation>Flusso Monitoraggi</xs:documentation>
              </xs:annotation>
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="periodo" maxOccurs="unbounded">
                             <xs:complexType>
                                  <xs:sequence>
                                       <xs:element name="segmento" maxOccurs="unbounded">
                                            <xs:complexType>
                                                 <xs:sequence>
                                                      <xs:element name="progressivo" maxOccurs="unbounded">
                                                           <xs:complexType>
                                                                <xs:sequence>
                                                                     <xs:element name="stato" type="xs:string"/>
                                                                     <xs:element name="ts_start" type="xs:string"/>
                                                                     <xs:element name="ts_stop" type="xs:string"/>
                                                                     <xs:element name="nota_esecuzione" type="xs:string"/>
                                                                     <xs:element name="ts_esecuzione" type="xs:string"/>
                                                                </xs:sequence>
                                                                <xs:attribute name="valore" type="xs:integer" use="required"/>
                                                           </xs:complexType>
                                                      </xs:element>
                                                 </xs:sequence>
                                                 <xs:attribute name="nome" type="xs:string" use="required"/>
                                            </xs:complexType>
                                       </xs:element>
                                  </xs:sequence>
                                  <xs:attribute name="nome" type="xs:string" use="required"/>
                             </xs:complexType>
                        </xs:element>
                   </xs:sequence>
                   <xs:attribute name="nome" type="xs:string"/>
              </xs:complexType>
         </xs:element>
    </xs:schema>
    When I try to read my xmltype column with this select :
    SELECT ap.desc_applicazione,pe.seq_periodo, pe.desc_elem_temp_ist,
    sg.desc_segmento_elab,pg.seq_progressivo,
    pg.desc_stato,pg.ts_start,pg.ts_stop,pg.nota_esecuzione,pg.ts_esecuzione,
    pg.valore_prog,sg.seq_segmento,idProg
    FROM testXML p,
    XMLTable('/applicazione' PASSING p.xmlData
    COLUMNS
    seq_applicazione for ordinality,
    desc_applicazione VARCHAR2(50) PATH '@nome',
    periodo XMLType PATH 'periodo') ap,
    XMLTable('periodo' PASSING ap.periodo
    COLUMNS
    seq_periodo for ordinality,
    desc_elem_temp_ist VARCHAR2(50) PATH '@nome',
    segmento XMLType PATH 'segmento') pe,
    XMLTable('segmento' PASSING pe.segmento
    COLUMNS
    seq_segmento for ordinality,
    desc_segmento_elab VARCHAR2(50) PATH '@nome',
    progressivo XMLTYPE PATH 'progressivo') sg,
    XMLTable('progressivo' PASSING sg.progressivo
    COLUMNS
    seq_progressivo for ordinality,
    valore_prog NUMBER PATH '@valore',
    desc_stato VARCHAR(10) PATH 'stato',
    ts_start VARCHAR2(50) PATH 'ts_start',
    ts_stop VARCHAR2(50) PATH 'ts_stop',
    nota_esecuzione VARCHAR2(50) PATH 'nota_esecuzione',
    ts_esecuzione VARCHAR2(50) PATH 'ts_esecuzione'
    ) pg
    where idProg = 1
    I obtained only 999 rows.
    I tried with two file xml, one containing 10000 repetition of progressivo, the other containing 10000 repetition of segmento.
    Anybody know why? Where is my error?
    Thank you in advance for any response.
    Maurizio

  • 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

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

Maybe you are looking for

  • How can I transfer music not purchased on iTunes to my new computer from my iPod?

    I recently got a new computer and wanted the music from my iPod on it. I have a ton of CD's so over half the things I have on my iPod aren't things I purchased from iTunes. When I went through the process of transferring (it only gave the option to t

  • Transport Acknowledgement in an Ansynchronous Send Step in BPM

    I tried this scenario /people/michal.krawczyk2/blog/2006/06/22/xi-playing-with-the-file-adapters-acknowledgments for a file acknowledgement in an ansynchronous send step in BPM and it worked fine. This made me think of something else... This SAP help

  • SwapDepths not working

    Ok, so I am trying to bring an object to the front of the screen when it's clicked on by using the following code: _mc.swapDepths(_mc._parent.getNextHighestDepth()); which seemed to be working fine until I spread it across objects. I have two objects

  • How to find a deployed VC model ?

    Hi, I have created a new model in Visual Composer and have deployed it to the portal. After that a window is automatically opened which displays the created iView. When I close this window and log in as a user with the role "eu_role" I can't find the

  • TS3694 this iphone,iphone cloud not restored

    the iphone"iphone" could not be restored.An unknown error occurred (1015).