ExistsNode exception with Schema based XMLType table

hi,
While running this query on structured table -->
SELECT OBJECT_VALUE
FROM Table_Structured
WHERE existsNode(OBJECT_VALUE, '/Entity/Fields[field2="stringvalue"]') = 1;
I get this exception -->
Error report:
SQL Error: ORA-00932: inconsistent datatypes: expected UDT got CHAR
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:   
*Action:
There is no problem running this on unstructured XMLType tables
What the problem ?
Thanks in advance.

To get an answer more meaningful than the one the error message gives you (and that's pretty clear as XML errors go), you're going to need to supply a bit more info. At least the relevant portion of the schema and the actual definition of the table. The database version never hurts either.
Chris

Similar Messages

  • Schema-based xmltype table

    Below mentioned is the schema-based xmltype table
    CREATE TABLE BRSK.MEDV_brpubdoc_tab OF XMLType
    XMLSCHEMA "http://xmlns.oracle.com/xdb/schemas/BRSK/www.medversation.com/brpubdoc/brpubdoc.xsd"
    ELEMENT "brpubdoc"
    TABLESPACE BRSK_M;
    when ever delete the old schema and register the new schema should i drop the previous xmltype table and create the new one?If this is the case then we will be losing the previous xml contents.Is there is a way to avoid drop and creation on xmltype table on schema delete and schema registration.Please help me out on this.

    I hava gone through the below mentioned link http://download-east.oracle.com/docs/cd/B12037_01/appdev.101/b10790/xdb07evo.htm which states In prior releases an XML schema, once registered with Oracle XML DB at a particular URL, could not be modified or evolved because there may be XMLType tables that depend on the XML schema. There was no standard procedure for schema evolution. This release supports XML schema evolution by providing a PL/SQL procedure CopyEvolve() a part of the DBMS_XMLSCHEMA package. CopyEvolve() involves copying existing instance documents to temporary tables, dropping and re-registering the XML schema, and copying the instance documents to the new XMLType tables.So i think schema evolution works in 10g only

  • Insert performance on a table with schema based XMLType column

    Hi,
    We are inserting around 500K rows into a table which has one XMLType column (schema based). Schema is simple and the size of the XMLType column is also not very large (on an average only around 100 bytes (max might be around 1k-2k), but it takes around 1 hr for every 20K rows, which seems very slow.
    The schema is like this :
    <schema targetNamespace="http://www.citadon.com/xml/test.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true"
    version="1.0" elementFormDefault="qualified">
    <element name="cas">
    <complexType>
    <sequence>
    <element name="ca" minOccurs="0" maxOccurs="unbounded">
    <complexType>
    <sequence>
    <element name="id" type="string"/>
    <element name="value" type="string"/>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    </schema>
    Any thoughts on how to improve performance?
    -Srini

    You need to have sufficient data.. Also the event show in the following code may help depending on the nature of the query....
    Note in the PurchaseOrder Example if I only have 133 docs, instead of 10,000 I will get tablescan and index full scans
    C:\oracle\xdb\bugs\xdbBasicDemo>sqlplus /nolog @testcase XDBTEST XDBTEST
    SQL*Plus: Release 10.1.0.3.0 - Production on Fri Aug 27 22:57:36 2004
    Copyright (c) 1982, 2004, 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 10000
    SQL> set feedback on
    SQL> set lines 132
    SQL> set pages 50
    SQL> --
    SQL> drop index iPartNumberIndex
    2 /
    Index dropped.
    Elapsed: 00:00:02.25
    SQL> alter index LINEITEM_LIST rebuild
    2 /
    Index altered.
    Elapsed: 00:00:02.15
    SQL> desc PURCHASEORDER
    Name Null? Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://localhost:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "Pu
    ject-relational TYPE "PURCHASEORDER_T"
    SQL> --
    SQL> col level format 99999
    SQL> col parent_table_column format A32
    SQL> col table_name format A32
    SQL> col table_type_name format A32
    SQL> --
    SQL> select level, PARENT_TABLE_COLUMN, TABLE_TYPE_NAME, TABLE_NAME
    2 from USER_NESTED_TABLES
    3 connect by PRIOR TABLE_NAME = PARENT_TABLE_NAME
    4 start with PARENT_TABLE_NAME = 'PURCHASEORDER'
    5 /
    LEVEL PARENT_TABLE_COLUMN TABLE_TYPE_NAME TABLE_NAME
    1 "XMLDATA"."ACTIONS"."ACTION" ACTION_V ACTION_TABLE
    1 "XMLDATA"."LINEITEMS"."LINEITEM" LINEITEM_V LINEITEM_TABLE
    2 rows selected.
    Elapsed: 00:00:13.60
    SQL> desc LINEITEM_T
    LINEITEM_T is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    ITEMNUMBER NUMBER(38)
    DESCRIPTION VARCHAR2(256 CHAR)
    PART PART_T
    SQL> --
    SQL> desc PART_T
    PART_T is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    PART_NUMBER VARCHAR2(14 CHAR)
    QUANTITY NUMBER(12,2)
    UNITPRICE NUMBER(8,4)
    SQL> --
    SQL> select count(*)
    2 from purchaseorder
    3 /
    COUNT(*)
    10000
    1 row selected.
    Elapsed: 00:00:05.31
    SQL> select count(*)
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 /
    COUNT(*)
    148814
    1 row selected.
    Elapsed: 00:09:40.54
    SQL> create index iPartNumberIndex
    2 on LINEITEM_TABLE l
    3 ( l.PART.PART_NUMBER,NESTED_TABLE_ID)
    4 /
    Index created.
    Elapsed: 00:00:36.11
    SQL> explain plan for
    2 select count(*)
    3 from purchaseorder
    4 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    Explained.
    Elapsed: 00:00:01.14
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 2571550067
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 116 | 93 (2)| 00:00:02 |
    | 1 | SORT AGGREGATE | | 1 | 116 | | |
    | 2 | NESTED LOOPS | | 25 | 2900 | 93 (2)| 00:00:02 |
    | 3 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 4 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 5 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
    |* 6 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 49 | 1 (0)| 00:00:01 |
    |* 7 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - access("SYS_NC00011$"='717951002372')
    5 - access("SYS_NC00011$"='717951002372')
    6 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
    stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
    ies/><read-contents/></privilege>''))=1)
    7 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    26 rows selected.
    Elapsed: 00:00:03.12
    SQL> select count(*)
    2 from purchaseorder
    3 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
    4 /
    COUNT(*)
    33
    1 row selected.
    Elapsed: 00:00:04.63
    SQL> select count(*)
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    COUNT(*)
    33
    1 row selected.
    Elapsed: 00:00:00.32
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 2571550067
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 116 | 93 (2)| 00:00:02 |
    | 1 | SORT AGGREGATE | | 1 | 116 | | |
    | 2 | NESTED LOOPS | | 25 | 2900 | 93 (2)| 00:00:02 |
    | 3 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 4 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 5 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
    |* 6 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 49 | 1 (0)| 00:00:01 |
    |* 7 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - access("SYS_NC00011$"='717951002372')
    5 - access("SYS_NC00011$"='717951002372')
    6 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
    stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
    ies/><read-contents/></privilege>''))=1)
    7 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    26 rows selected.
    Elapsed: 00:00:00.04
    SQL> explain plan for
    2 select extractValue(object_value,'/PurchaseOrder/Reference')
    3 from purchaseorder,
    4 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    5 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    6 /
    Explained.
    Elapsed: 00:00:00.07
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 713363872
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 8000 | 104 (0)| 00:00:02 |
    | 1 | NESTED LOOPS | | 25 | 8000 | 104 (0)| 00:00:02 |
    |* 2 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
    |* 4 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 253 | 1 (0)| 00:00:01 |
    |* 5 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("SYS_NC00011$"='717951002372')
    3 - access("SYS_NC00011$"='717951002372')
    4 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
    nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
    ties/><read-contents/></privilege>''))=1)
    5 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    24 rows selected.
    Elapsed: 00:00:00.04
    SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    EXTRACTVALUE(OBJECT_VALUE,'/PU
    MWEISS-20030616154327385GMT
    NSARCHAN-20030703170041824GMT
    HBAER-20030206173836987GMT
    LOZER-20031110131149107GMT
    WTAYLOR-20030120174534374GMT
    MHARTSTE-20031103172937613GMT
    KGEE-20030919215826550GMT
    PSULLY-20030712141634504GMT
    JPATEL-20030630175356693GMT
    RMATOS-2003072920455000GMT
    DRAPHEAL-20030528180033254GMT
    JRUSSEL-20031121213026539GMT
    PTUCKER-20030918160532301GMT
    SVOLLMAN-20031027120838903GMT
    WGIETZ-20030208185026303GMT
    TFOX-20030110164614994GMT
    JPATEL-20030304214301386GMT
    GGEONI-20030606135257846GMT
    STOBIAS-20030817120358785GMT
    COLSEN-20030525200717658GMT
    SBAIDA-20030224182546606GMT
    IMIKKILI-20030118180347537GMT
    ABULL-20030429162730766GMT
    NSARCHAN-20031113183134873GMT
    LBISSOT-20030809134114505GMT
    JKING-20030420162058859GMT
    JMALLIN-20030506152048261GMT
    AFRIPP-20030311153808601GMT
    SHIGGINS-20030831151756257GMT
    DBERNSTE-20030626122725631GMT
    KPARTNER-20031021160248962GMT
    ABANDA-2003062721524842GMT
    DOCONNEL-20030904214708637GMT
    33 rows selected.
    Elapsed: 00:00:00.07
    SQL> explain plan for
    2 select extractValue(object_value,'/PurchaseOrder/Reference')
    3 from purchaseorder
    4 where existsNode
    5 (
    6 object_value,
    7 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
    8 ) = 1
    9 /
    Explained.
    Elapsed: 00:00:00.02
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 849879259
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 8000 | 93 (2)| 00:00:02 |
    | 1 | NESTED LOOPS | | 25 | 8000 | 93 (2)| 00:00:02 |
    | 2 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 3 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
    |* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
    |* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 253 | 1 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - access("SYS_NC00011$"='717951002372')
    4 - access("SYS_NC00011$"='717951002372')
    5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
    nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
    ties/><read-contents/></privilege>''))=1)
    6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    25 rows selected.
    Elapsed: 00:00:00.03
    SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
    2 from purchaseorder
    3 where existsNode
    4 (
    5 object_value,
    6 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
    7 ) = 1
    8 /
    EXTRACTVALUE(OBJECT_VALUE,'/PU
    MWEISS-20030616154327385GMT
    NSARCHAN-20030703170041824GMT
    HBAER-20030206173836987GMT
    LOZER-20031110131149107GMT
    WTAYLOR-20030120174534374GMT
    MHARTSTE-20031103172937613GMT
    KGEE-20030919215826550GMT
    PSULLY-20030712141634504GMT
    JPATEL-20030630175356693GMT
    RMATOS-2003072920455000GMT
    DRAPHEAL-20030528180033254GMT
    JRUSSEL-20031121213026539GMT
    PTUCKER-20030918160532301GMT
    SVOLLMAN-20031027120838903GMT
    WGIETZ-20030208185026303GMT
    TFOX-20030110164614994GMT
    JPATEL-20030304214301386GMT
    GGEONI-20030606135257846GMT
    STOBIAS-20030817120358785GMT
    COLSEN-20030525200717658GMT
    SBAIDA-20030224182546606GMT
    IMIKKILI-20030118180347537GMT
    ABULL-20030429162730766GMT
    NSARCHAN-20031113183134873GMT
    LBISSOT-20030809134114505GMT
    JKING-20030420162058859GMT
    JMALLIN-20030506152048261GMT
    AFRIPP-20030311153808601GMT
    SHIGGINS-20030831151756257GMT
    DBERNSTE-20030626122725631GMT
    KPARTNER-20031021160248962GMT
    ABANDA-2003062721524842GMT
    DOCONNEL-20030904214708637GMT
    33 rows selected.
    Elapsed: 00:00:00.04
    SQL> alter session set events ='19027 trace name context forever, level 0x800000'
    2 /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> explain plan for
    2 select count(*)
    3 from purchaseorder
    4 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    Explained.
    Elapsed: 00:00:00.03
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 3049344732
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 69 | 17 (6)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | 69 | | |
    | 2 | NESTED LOOPS | | 25 | 1725 | 17 (6)| 00:00:01 |
    | 3 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
    |* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
    |* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 39 | 1 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - access("SYS_NC00011$"='717951002372')
    5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
    stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
    ies/><read-contents/></privilege>''))=1)
    6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    24 rows selected.
    Elapsed: 00:00:00.03
    SQL> select count(*)
    2 from purchaseorder
    3 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
    4 /
    COUNT(*)
    33
    1 row selected.
    Elapsed: 00:00:00.01
    SQL> select count(*)
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    COUNT(*)
    33
    1 row selected.
    Elapsed: 00:00:00.01
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 3049344732
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 69 | 17 (6)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | 69 | | |
    | 2 | NESTED LOOPS | | 25 | 1725 | 17 (6)| 00:00:01 |
    | 3 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
    |* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
    |* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 39 | 1 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - access("SYS_NC00011$"='717951002372')
    5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
    stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
    ies/><read-contents/></privilege>''))=1)
    6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    24 rows selected.
    Elapsed: 00:00:00.03
    SQL> explain plan for
    2 select extractValue(object_value,'/PurchaseOrder/Reference')
    3 from purchaseorder,
    4 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    5 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    6 /
    Explained.
    Elapsed: 00:00:00.06
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 1516269755
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 2450 | 28 (0)| 00:00:01 |
    | 1 | NESTED LOOPS | | 25 | 2450 | 28 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
    |* 3 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 68 | 1 (0)| 00:00:01 |
    |* 4 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("SYS_NC00011$"='717951002372')
    3 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
    nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
    ties/><read-contents/></privilege>''))=1)
    4 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    22 rows selected.
    Elapsed: 00:00:00.04
    SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
    2 from purchaseorder,
    3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
    4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
    5 /
    EXTRACTVALUE(OBJECT_VALUE,'/PU
    MWEISS-20030616154327385GMT
    NSARCHAN-20030703170041824GMT
    HBAER-20030206173836987GMT
    LOZER-20031110131149107GMT
    WTAYLOR-20030120174534374GMT
    MHARTSTE-20031103172937613GMT
    KGEE-20030919215826550GMT
    PSULLY-20030712141634504GMT
    JPATEL-20030630175356693GMT
    RMATOS-2003072920455000GMT
    DRAPHEAL-20030528180033254GMT
    JRUSSEL-20031121213026539GMT
    PTUCKER-20030918160532301GMT
    SVOLLMAN-20031027120838903GMT
    WGIETZ-20030208185026303GMT
    TFOX-20030110164614994GMT
    JPATEL-20030304214301386GMT
    GGEONI-20030606135257846GMT
    STOBIAS-20030817120358785GMT
    COLSEN-20030525200717658GMT
    SBAIDA-20030224182546606GMT
    IMIKKILI-20030118180347537GMT
    ABULL-20030429162730766GMT
    NSARCHAN-20031113183134873GMT
    LBISSOT-20030809134114505GMT
    JKING-20030420162058859GMT
    JMALLIN-20030506152048261GMT
    AFRIPP-20030311153808601GMT
    SHIGGINS-20030831151756257GMT
    DBERNSTE-20030626122725631GMT
    KPARTNER-20031021160248962GMT
    ABANDA-2003062721524842GMT
    DOCONNEL-20030904214708637GMT
    33 rows selected.
    Elapsed: 00:00:00.01
    SQL> explain plan for
    2 select extractValue(object_value,'/PurchaseOrder/Reference')
    3 from purchaseorder
    4 where existsNode
    5 (
    6 object_value,
    7 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
    8 ) = 1
    9 /
    Explained.
    Elapsed: 00:00:00.03
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
    2 /
    PLAN_TABLE_OUTPUT
    Plan hash value: 1197255270
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 2450 | 17 (6)| 00:00:01 |
    | 1 | NESTED LOOPS | | 25 | 2450 | 17 (6)| 00:00:01 |
    | 2 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
    |* 4 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 68 | 1 (0)| 00:00:01 |
    |* 5 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    3 - access("SYS_NC00011$"='717951002372')
    4 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
    xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
    nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
    http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
    ties/><read-contents/></privilege>''))=1)
    5 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
    23 rows selected.
    Elapsed: 00:00:00.03
    SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
    2 from purchaseorder
    3 where existsNode
    4 (
    5 object_value,
    6 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
    7 ) = 1
    8 /
    EXTRACTVALUE(OBJECT_VALUE,'/PU
    MWEISS-20030616154327385GMT
    NSARCHAN-20030703170041824GMT
    HBAER-20030206173836987GMT
    LOZER-20031110131149107GMT
    WTAYLOR-20030120174534374GMT
    MHARTSTE-20031103172937613GMT
    KGEE-20030919215826550GMT
    PSULLY-20030712141634504GMT
    JPATEL-20030630175356693GMT
    RMATOS-2003072920455000GMT
    DRAPHEAL-20030528180033254GMT
    JRUSSEL-20031121213026539GMT
    PTUCKER-20030918160532301GMT
    SVOLLMAN-20031027120838903GMT
    WGIETZ-20030208185026303GMT
    TFOX-20030110164614994GMT
    JPATEL-20030304214301386GMT
    GGEONI-20030606135257846GMT
    STOBIAS-20030817120358785GMT
    COLSEN-20030525200717658GMT
    SBAIDA-20030224182546606GMT
    IMIKKILI-20030118180347537GMT
    ABULL-20030429162730766GMT
    NSARCHAN-20031113183134873GMT
    LBISSOT-20030809134114505GMT
    JKING-20030420162058859GMT
    JMALLIN-20030506152048261GMT
    AFRIPP-20030311153808601GMT
    SHIGGINS-20030831151756257GMT
    DBERNSTE-20030626122725631GMT
    KPARTNER-20031021160248962GMT
    ABANDA-2003062721524842GMT
    DOCONNEL-20030904214708637GMT
    33 rows selected.
    Elapsed: 00:00:00.03
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options

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

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

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

  • Accessing schema-based XML table

    HI Gentlemen,
    I have a schema-based XMLtype table that I have to query in detail (e.g. via XPath). Documentation states that XML mapping is possible through some Java programming. However, I do not have XML content in a .xml file, it has already been loaded into Oracle DB (that is - non-JAXB)!
    Can anybody recommend a sample code or description of the technology?
    Thanks, regards from
    Miklos HERBOLY

    Your xml document may by represented as an column, you will got the content as other attributes.
    You will not be able to manage the structure of your document natively via the adf layer ... you may marshall/unmarshall the content into a class you build with jaxb or with castor by example (much better interface and classes).
    Note that you will be able to generate a data control from the class that represent the document and use the elements (and/or attributes) of your sturcture in your web pages by drag and drop like for columns in a table.
    Hope this help a little bit

  • Can't insert schema-based xmltype into binary xmltype table

    I'm having issues trying to use binary storage along with the ALLOW ANYSCHEMA clause. I can't use the XMLSchema-instance mechanism for creating my schema-based XMLType instances, so I'm using CreateSchemaBasedXml. When I try to insert the XMLType into the table, however, it seems to think it's not schema-based and throws an error. I trimmed down my schema for the purposes of this example. Here's the schema (schematest.xsd):
    <?xml version="1.0" encoding="Windows-1252"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="FORMINFO">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="SUBJECT">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="ADDR">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="STREET" type="xs:string" />
                        <xs:element name="CITY" type="xs:string" />
                        <xs:element name="STATEPROV" type="xs:string" />
                        <xs:element name="ZIP" type="xs:string" />
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>Here's the instance file (schema testinst.xml):
    <?xml version="1.0" encoding="utf-8"?>
    <FORMINFO>
       <SUBJECT>
          <ADDR>
             <STREET>123 Main St</STREET>
             <CITY>Las Vegas</CITY>
             <STATEPROV>NV</STATEPROV>
             <ZIP>12345</ZIP>
          </ADDR>
       </SUBJECT>
    </FORMINFO>I registered the schema and created the test table:
    BEGIN
      DBMS_XMLSCHEMA.registerschema(
       schemaurl => 'http://localhost/schematest.xsd',
       schemadoc => bfilename('XMLDIR','schematest.xsd'),
       gentables => false,
       gentypes => false,
       csid => nls_charset_id('AL32UTF8'),
       options => DBMS_XMLSCHEMA.REGISTER_BINARYXML);
    END;
    CREATE TABLE BINARYTEST OF XMLType
    XMLTYPE STORE AS BINARY XML
    ALLOW ANYSCHEMA;But trying to insert gives me an ORA-44422 error (this is on Oracle 11.1.0.7.0 Enterprise):
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(bfilename('XMLDIR', 'schematestinst.xml'), nls_charset_id('AL32UTF8'));
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    declare
    ERROR at line 1:
    ORA-44422: nonschema XML disallowed for this column
    ORA-06512: at line 10You can see from my put_line statement that the XMLType object is reporting its schema URL correctly and thinks it's been validated. Changing the table to "ALLOW NONSCHEMA" allows the insert, but it inserts it as a non-schema-based document. Am I skipping a step here?
    Thanks,
    Jim

    It might be a bug, but I am not yet sure...
    See the following examples...
    c:\>C:\oracle\product\11.1.0\db_1\bin\sqlplus.exe /nolog
    SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar 23 22:14:41 2009
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    SQL> drop user otn cascade;
    User dropped.
    SQL> create user otn identified by otn;
    User created.
    SQL> grant xdbadmin, dba to otn;
    Grant succeeded.
    SQL> conn otn/otn
    connected.
    SQL> var schemaPath varchar2(256)
    SQL> var schemaURL  varchar2(256)
    SQL>
    SQL> begin
      2    :schemaURL := 'http://localhost/schematest.xsd';
      3    :schemaPath := '/public/schematest.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType('<?xml version="1.0" encoding="Windows-1252"?>
      4  <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      5    <xs:element name="FORMINFO">
      6      <xs:complexType>
      7        <xs:sequence>
      8          <xs:element name="SUBJECT">
      9            <xs:complexType>
    10              <xs:sequence>
    11                <xs:element name="ADDR">
    12                  <xs:complexType>
    13                    <xs:sequence>
    14                      <xs:element name="STREET" type="xs:string" />
    15                      <xs:element name="CITY" type="xs:string" />
    16                      <xs:element name="STATEPROV" type="xs:string" />
    17                      <xs:element name="ZIP" type="xs:string" />
    18                    </xs:sequence>
    19                  </xs:complexType>
    20                </xs:element>
    21              </xs:sequence>
    22            </xs:complexType>
    23          </xs:element>
    24        </xs:sequence>
    25      </xs:complexType>
    26    </xs:element>
    27  </xs:schema>');
    28  begin
    29  if (dbms_xdb.existsResource(:schemaPath)) then
    30      dbms_xdb.deleteResource(:schemaPath);
    31  end if;
    32   res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    33  end;
    34  /
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> call dbms_xmlschema.deleteSchema(:schemaURL,4);
    Call completed.
    SQL> BEGIN
      2   DBMS_XMLSCHEMA.registerSchema(
      3    SCHEMAURL => :SchemaURL,
      4    SCHEMADOC => xdbURIType(:SchemaPath).getClob(),
      5    LOCAL     => FALSE, -- local
      6    GENTYPES  => FALSE, -- generate object types
      7    GENBEAN   => FALSE, -- no java beans
      8    GENTABLES => FALSE, -- generate object tables
      9    OPTIONS   => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
    10    OWNER     => USER
    11   );
    12  END;
    13  /
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> var schemaDoc  varchar2(256)
    SQL>
    SQL> begin
      2    :schemaDoc := '/public/schematest.xml';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Create an XML Document in the repository
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlDoc xmlType := xmlType('<?xml version="1.0" encoding="utf-8"?>
      4  <FORMINFO>
      5     <SUBJECT>
      6        <ADDR>
      7           <STREET>123 Main St</STREET>
      8           <CITY>Las Vegas</CITY>
      9           <STATEPROV>NV</STATEPROV>
    10           <ZIP>12345</ZIP>
    11        </ADDR>
    12     </SUBJECT>
    13  </FORMINFO>');
    14  begin
    15  if (dbms_xdb.existsResource(:schemaDoc)) then
    16      dbms_xdb.deleteResource(:schemaDoc);
    17  end if;
    18   res := dbms_xdb.createResource(:schemaDoc,xmlDoc);
    19  end;
    20  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Ready to test
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> select * from tab;
    no rows selected
    SQL> CREATE TABLE BINARYTEST OF XMLType
      2  XMLTYPE STORE AS BINARY XML
      3  ALLOW ANYSCHEMA;
    Table created.
    SQL> set long 100000
    SQL> select dbms_metadata.get_ddl('TABLE','BINARYTEST',user) from dual;
    DBMS_METADATA.GET_DDL('TABLE','BINARYTEST',USER)
      CREATE TABLE "OTN"."BINARYTEST" OF "SYS"."XMLTYPE"
    OIDINDEX  ( PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" )
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    XMLTYPE COLUMN OBJECT_VALUE STORE AS BASICFILE BINARY XML (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT))
    DISALLOW NONSCHEMA
    ALLOW ANYSCHEMA
    1 row selected.
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    declare
    ERROR at line 1:
    ORA-44422: nonschema XML disallowed for this column
    ORA-06512: at line 10
    -- ORA-44421: cannot DISALLOW NONSCHEMA without a SCHEMA clause
    -- Cause: If no SCHEMA clause (explicit schema or ANYSCHEMA) was specified, nonschema data cannot be disallowed.-
    -- Action: Remove DISALLOW NONSCHEMA or add some SCHEMA clause.
    SQL> drop table binarytest;
    Table dropped.
    SQL> CREATE TABLE BINARYTEST OF XMLType
      2  XMLTYPE STORE AS BINARY XML
      3  ALLOW NONSCHEMA;
    Table created.
    SQL> select dbms_metadata.get_ddl('TABLE','BINARYTEST',user) from dual;
    DBMS_METADATA.GET_DDL('TABLE','BINARYTEST',USER)
      CREATE TABLE "OTN"."BINARYTEST" OF "SYS"."XMLTYPE"
    OIDINDEX  ( PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" )
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    XMLTYPE COLUMN OBJECT_VALUE STORE AS BASICFILE BINARY XML (
      TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10
      NOCACHE LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
    BUFFER_POOL DEFAULT))
    ALLOW NONSCHEMA
    DISALLOW ANYSCHEMA
    1 row selected.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
      7    xschema.SchemaValidate();
      8    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
      9
    10    INSERT INTO BINARYTEST
    11    VALUES (xschema);
    12    commit;
    13  end;
    14  /
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> select * from binarytest;
    SYS_NC_ROWINFO$
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    1 row selected.
    SQL> SET SERVEROUTPUT ON
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValidated());
    15
    16    INSERT INTO BINARYTEST
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> create table ORtest of xmltype
      2  xmlschema "http://localhost/schematest.xsd" element "FORMINFO"
      3  ;
    Table created.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO ORTEST
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO BIN_ONE_SCHEMA
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
        </ADDR>
      </SUBJECT>
    </FORMINFO>
    Schema: http://localhost/schematest.xsd Validated: 1
    PL/SQL procedure successfully completed.
    SQL> ----------------------------------------------------------
    SQL>
    SQL> -- Create an XML Document in the repository
    SQL>
    SQL> ----------------------------------------------------------
    SQL>
    SQL> declare
      2    res boolean;
      3    xmlDoc xmlType := xmlType('<?xml version="1.0" encoding="utf-8"?>
      4  <FORMINFO>
      5     <SUBJECT>
      6        <ADDR>
      7           <STREET>123 Main St</STREET>
      8           <CITY>Las Vegas</CITY>
      9           <STATEPROV>NV</STATEPROV>
    10           <ZIP>12345</ZIP>
    11           <ONE_TO_MANY>say what?</ONE_TO_MANY>
    12        </ADDR>
    13     </SUBJECT>
    14  </FORMINFO>');
    15  begin
    16  if (dbms_xdb.existsResource(:schemaDoc)) then
    17      dbms_xdb.deleteResource(:schemaDoc);
    18  end if;
    19   res := dbms_xdb.createResource(:schemaDoc,xmlDoc);
    20  end;
    21  /
    PL/SQL procedure successfully completed.
    SQL> declare
      2    x XMLType;
      3    xschema XMLType;
      4  begin
      5    x := XMLType(xdbUriType(:SchemaDoc).getClob());
      6
      7    dbms_output.put_line(x.getstringval());
      8
      9    xschema := x.CreateSchemaBasedXml('http://localhost/schematest.xsd');
    10
    11    dbms_output.put_line(xschema.getstringval());
    12
    13    xschema.SchemaValidate();
    14    DBMS_OUTPUT.PUT_LINE('Schema: ' || xschema.GetSchemaURL() || ' Validated: ' || xschema.IsSchemaValid());
    15
    16    INSERT INTO BIN_ONE_SCHEMA
    17    VALUES (xschema);
    18    commit;
    19  end;
    20  /
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
          <ONE_TO_MANY>say what?</ONE_TO_MANY>
        </ADDR>
    </SUBJECT>
    </FORMINFO>
    <?xml version="1.0" encoding="UTF-8"?>
    <FORMINFO>
      <SUBJECT>
        <ADDR>
          <STREET>123 Main St</STREET>
          <CITY>Las
    Vegas</CITY>
          <STATEPROV>NV</STATEPROV>
          <ZIP>12345</ZIP>
          <ONE_TO_MANY>say what?</ONE_TO_MANY>
        </ADDR>
    </SUBJECT>
    </FORMINFO>
    declare
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00213: only 0 occurrences of particle "ADDR", minimum is 1
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at line 13
    SQL>

  • XML Schema based XMLType column leaves file open on error

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

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

  • Script for comparing 2 schemas based upon table compare

    Hi,
    I want to write a script on 2 schemas TEST and TEST1 which will compare the difference in tables in both schemas and will Insert Data
    into schema TEST from TEST1 depending upon the matched columns in schema TEST and TEST1
    Any help will be nedful for me

    I want to write a script on 2 schemas TEST and TEST1 which will compare the difference in tables Differences in METADATA or differences in data.?
    It would be helpful if you provided DDL for tables involved.
    It would be helpful if you provided DML for test data.
    It would be helpful if you provided expected/desired results & a detailed explanation how & why the test data gets transformed or organized.

  • ORMI Connect Exception with IP-Based Virtual Hosts

    I currently am using OAS 10.1.2 and have a virtual host setup with the Oc4j mounted at the root of the domain.
    i.e.
    http://mydomain.com (Takes you straight to the application)
    as apposed to
    http://mydomain.com/myapplication (Which appears to be the default configuration)
    When I setup my ormi url to the following ormi://mydomain.com:12500/ I get java.net.ConnectException: Connection refused. error.
    If remove the Virtual Host configuration then specify the ormi url to be ormi://mydomain.com/myapplication I do no get the error.
    Does anyone know how to setup ormi with oc4j applications mounted to the root of a domain.
    Thanks

    you need to define a virtual server for it..but inside that definition.. define a proxy.
    Then the middle webserver, will actually handle the request to the intranet server, on behalf of the internet client..and then pass the traffic to the internet client.
    this looks like a reasonable example..
    http://www.linuxfocus.org/English/March … le147.html
    namely, the section "Mapping Virtual Servers"

  • Selecting from XMLTYPE table

    HI Gentlemen,
    Given a schema-based XMLTYPE table with one big XML instance stored in it. I would like to select a subtree like <gnr V="12345" ...> ... </gnr> where the attribute could be a bind parameter dynamically changing. As an output I would like to have the whole subtree with XML tags, for which I already have a perfectly good XSL stylesheet to display contents. It is working well when the subtree is stored in an .xml file which references the .xsl stylesheet. My question is: How can I organize that the ADF view is connected to the stylesheet and how can I apply all that to a .jspx ADF page? Updating the table is not a matter. Please help if you can.
    Thanks, regards
    Miklos HERBOLY

    If you already have the correct xsl file to use, you might consider creating a xsql page instead of a jspx page:
    http://people.cis.ksu.edu/~hankley/d764/tut05/Kamath_XSQL.html
    NA
    http://nickaiva.blogspot.com

  • XMLType table Core Dump using CLOB

    I've created an object based XMLType table based on a valid XML Schema. The Schema has an element which has been declared as a CLOB.
    <xs:element name="complete_entry" xdb:SQLType="CLOB" xdb:SQLName="complete_entry"/>
    This registers ok with Oracle and the object that this element is in shows the element as a CLOB as expected.
    However when performing a insert into this table, SQLPlus gives and end-of-communication error and the server core dumps.
    A PL/SQL function retreives an XML file from the file system for insert, here is the code for the function:
    create or replace function getClobDocument(
    filename in varchar2,
    charset in varchar2 default NULL)
    return CLOB deterministic
    is
    file bfile := bfilename('DIR',filename);
    charContent CLOB := ' ';
    targetFile bfile;
    lang_ctx number := DBMS_LOB.default_lang_ctx;
    charset_id number := 0;
    src_offset number := 1 ;
    dst_offset number := 1 ;
    warning number;
    begin
    if charset is not null then
    charset_id := NLS_CHARSET_ID(charset);
    end if;
    targetFile := file;
    DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly);
    DBMS_LOB.LOADCLOBFROMFILE(charContent, targetFile,
    DBMS_LOB.getLength(targetFile), src_offset, dst_offset,
    charset_id, lang_ctx,warning);
    DBMS_LOB.fileclose(targetFile);
    return charContent;
    end;
    The function is called like so:
    INSERT INTO boss_contracts
    VALUES(XMLTYPE(getCLOBDocument('contract_82.xml','UTF8')));
    This works perfectly when the element is declared as a string and Oracle converts it to a varchar2(4000), but core dumps when it is a CLOB.
    I need this element to be able to handle more than 4k of data.
    please help,
    Paul Linney
    [email protected]

    void print_affect(struct oci_connection* conn, OCIStmt* sh) {
    sb2 rowCount;
    ub4 sizep = sizeof(sb2);
    OCIAttrGet(sh, OCI_HTYPE_STMT,&rowCount,
    &sizep,OCI_ATTR_ROW_COUNT, conn->err);OCI_ATTR_ROW_COUNT is a ub4 attribute, not a sb2 one.
    ub4 rowCount = 0;
    ub4 size = sizeof(rowCount);
    --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Valid vs Schema Based

    What is the major difference between a schema based document and a valid document?

    Those are two different, not comparable, notions.
    You can see each one as an internal flag in an XMLType instance.
    An XMLType instance may be :
    1) schema-based or not schema-based :
    "schema-based" means that the XMLType is tied to a registered schema in the database.
    This association may be done automatically while constructing the XMLType if the document possesses a correct xsi:schemaLocation or xsi:noNamespaceSchemaLocation attribute, or manually when calling the createSchemaBasedXML method.
    2) valid or not valid :
    "valid" means the document has been validated against the schema, or set in the valid state.
    There are different way to do that, for example :
    - schemaValidate() method
    - setSchemaValidated() method (not used that much)
    - inserting document in a schema-based XMLType column (binary XML)
    A valid XML has to be schema-based, but a schema-based XML is not necessary valid.

  • Adding a document to XMLTYPE table with schema

    Hi all:
    I am doing an example to create a table with a
    registered schema associated (in Oracle9ir2), and i am
    trying to insert a document that fits to schema into the
    table.
    The example is very simple:
    I have the following schema:
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
    <element name="items">
    <complexType>
    <sequence>
    <element name="item" type="string" maxOccurs="unbounded"/>
    </sequence>
    </complexType>
    </element>
    </schema>
    I succeed in registering the schema:
    begin
    DBMS_XMLSCHEMA.registerSchema(
    'http://localhost/items.xsd',
    getDocument('items.xsd'),
    TRUE, TRUE, FALSE, FALSE
    end;
    I succeed in creating a table with this schema:
    CREATE TABLE items of XMLType
    XMLSCHEMA "http://localhost/items.xsd"
    ELEMENT "items";
    And i have the following document:
    <?xml version="1.0"?>
    <items xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://localhost/items.xsd">
    <item>Item1</item>
    <item>Item2</item>
    </items>
    But when i try to insert it into the table with:
    INSERT INTO items VALUES (XMLTYPE(getDocument('items1.xml')));
    (getDocument is exactly the same as in XML Database
    Developer's Guid[i]Long postings are being truncated to ~1 kB at this time.

    truncated mail continuation...
    (getDocument is exactly the same as in XML Database
    Developer's Guide - Oracle XML DB Release 2 (9.2))
    I get:
    SQL> INSERT INTO items VALUES (XMLTYPE(getDocument('items1.xml')));
    INSERT INTO items VALUES (XMLTYPE(getDocument('items1.xml')))
    ERROR at line 1:
    ORA-19007: Schema and element do not match
    Do you know which is the problem?
    I have proved changing the headers of the xml document
    and schema in severals way, but it doesn't work.
    Could be a problem with Oracle configuration?
    Thanks in advance,
    Mario Barcala

  • How to improve performance of a query that is based on an xmltype table

    Dear Friends,
    I have a query that is pulling records from an xmltype table with 9000 rows and it is running very slow.
    I am using XMLTABLE command to retreive the rows. It is taking upto 30 minutes to finish.
    Would you be able to suggest how I can make it faster. Thanks.
    Below is the query.....
    INSERT INTO temp_sap_po_receipt_history_t
    (po_number, po_line_number, doc_year,
    material_doc, material_doc_item, quantity, sap_ref_doc_no_long,
    reference_doc, movement_type_code,
    sap_ref_doc_no, posting_date, entry_date, entry_time, hist_type)
    SELECT :pin_po_number po_number,
    b.po_line_number, b.doc_year,
    b.material_doc, b.material_doc_item, b.quantity, b.sap_ref_doc_no_long,
    b.reference_doc, b.movement_type_code,
    b.sap_ref_doc_no, to_date(b.posting_date,'rrrr-mm-dd'),
    to_date(b.entry_date,'rrrr-mm-dd'), b.entry_time, b.hist_type
    FROM temp_xml t,
    XMLTABLE(XMLNAMESPACES('urn:sap-com:document:sap:rfc:functions' AS "n0"),
    '/n0:BAPI_PO_GETDETAIL1Response/POHISTORY/item'
    PASSING t.object_value
    COLUMNS PO_LINE_NUMBER VARCHAR2(20) PATH 'PO_ITEM',
    DOC_YEAR varchar2(4) PATH 'DOC_YEAR',
    MATERIAL_DOC varchar2(30) PATH 'MAT_DOC',
    MATERIAL_DOC_ITEM VARCHAR2(10) PATH 'MATDOC_ITEM',
    QUANTITY NUMBER(20,6) PATH 'QUANTITY',
    SAP_REF_DOC_NO_LONG VARCHAR2(20) PATH 'REF_DOC_NO_LONG',
    REFERENCE_DOC VARCHAR2(20) PATH 'REF_DOC',
    MOVEMENT_TYPE_CODE VARCHAR2(4) PATH 'MOVE_TYPE',
    SAP_REF_DOC_NO VARCHAR2(20) PATH 'REF_DOC_NO',
    POSTING_DATE VARCHAR2(10) PATH 'PSTNG_DATE',
    ENTRY_DATE VARCHAR2(10) PATH 'ENTRY_DATE',
    ENTRY_TIME VARCHAR2(8) PATH 'ENTRY_TIME',
    HIST_TYPE VARCHAR2(5) PATH 'HIST_TYPE') b;

    Based on response from mdrake on this thread:
    Re: XML file processing into oracle
    For large XML's, you can speed up the processing of XMLTABLE by using a registered schema...
    declare
      SCHEMAURL VARCHAR2(256) := 'http://xmlns.example.org/xsd/testcase.xsd';
      XMLSCHEMA VARCHAR2(4000) := '<?xml version="1.0" encoding="UTF-8"?>
         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
            <xs:element name="cust_order" type="cust_orderType" xdb:defaultTable="CUST_ORDER_TBL"/>
            <xs:complexType name="groupType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="item" type="itemType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="id" type="xs:byte" use="required"/>
            </xs:complexType>
            <xs:complexType name="itemType" xdb:maintainDOM="false">
                    <xs:simpleContent>
                            <xs:extension base="xs:string">
                                    <xs:attribute name="id" type="xs:short" use="required"/>
                                    <xs:attribute name="name" type="xs:string" use="required"/>
                            </xs:extension>
                    </xs:simpleContent>
            </xs:complexType>
            <xs:complexType name="cust_orderType" xdb:maintainDOM="false">
                    <xs:sequence>
                            <xs:element name="group" type="groupType" maxOccurs="unbounded"/>
                    </xs:sequence>
                    <xs:attribute name="cust_id" type="xs:short" use="required"/>
            </xs:complexType>
         </xs:schema>';
      INSTANCE  CLOB :=
    '<cust_order cust_id="12345">
      <group id="1">
        <item id="1" name="Standard Mouse">100</item>
        <item id="2" name="Keyboard">100</item>
        <item id="3" name="Memory Module 2Gb">200</item>
        <item id="4" name="Processor 3Ghz">25</item>
        <item id="5" name="Processor 2.4Ghz">75</item>
      </group>
      <group id="2">
        <item id="1" name="Graphics Tablet">15</item>
        <item id="2" name="Keyboard">15</item>
        <item id="3" name="Memory Module 4Gb">15</item>
        <item id="4" name="Processor Quad Core 2.8Ghz">15</item>
      </group>
      <group id="3">
        <item id="1" name="Optical Mouse">5</item>
        <item id="2" name="Ergo Keyboard">5</item>
        <item id="3" name="Memory Module 2Gb">10</item>
        <item id="4" name="Processor Dual Core 2.4Ghz">5</item>
        <item id="5" name="Dual Output Graphics Card">5</item>
        <item id="6" name="28inch LED Monitor">10</item>
        <item id="7" name="Webcam">5</item>
        <item id="8" name="A3 1200dpi Laser Printer">2</item>
      </group>
    </cust_order>';                
    begin
      dbms_xmlschema.registerSchema
         schemaurl       => SCHEMAURL
        ,schemadoc       => XMLSCHEMA
        ,local           => TRUE
        ,genTypes        => TRUE
        ,genBean         => FALSE
        ,genTables       => TRUE
        ,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
      execute immediate 'insert into CUST_ORDER_TBL values (XMLTYPE(:INSTANCE))' using INSTANCE;
    end;
    SQL> desc CUST_ORDER_TBL
    Name                                                                                                                                    Null?    Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://xmlns.example.org/xsd/testcase.xsd" Element "cust_order") STORAGE Object-relational TYPE "cust_orderType222_T"
    SQL> set autotrace on explain
    SQL> set pages 60 lines 164 heading on
    SQL> col cust_id format a8
    SQL> select extract(object_value,'/cust_order/@cust_id') as cust_id
      2        ,grp.id as group_id, itm.id as item_id, itm.inm as item_name, itm.qty as item_qty
      3  from   CUST_ORDER_TBL
      4        ,XMLTABLE('/cust_order/group'
      5                  passing object_value
      6                  columns id   number       path '@id'
      7                         ,item xmltype      path 'item'
      8                 ) grp
      9        ,XMLTABLE('/item'
    10                  passing grp.item
    11                  columns id   number       path '@id'
    12                         ,inm  varchar2(30) path '@name'
    13                         ,qty  number       path '.'
    14                 ) itm
    15  /
    CUST_ID    GROUP_ID    ITEM_ID ITEM_NAME                        ITEM_QTY
    12345             1          1 Standard Mouse                        100
    12345             1          2 Keyboard                              100
    12345             1          3 Memory Module 2Gb                     200
    12345             1          4 Processor 3Ghz                         25
    12345             1          5 Processor 2.4Ghz                       75
    12345             2          1 Graphics Tablet                        15
    12345             2          2 Keyboard                               15
    12345             2          3 Memory Module 4Gb                      15
    12345             2          4 Processor Quad Core 2.8Ghz             15
    12345             3          1 Optical Mouse                           5
    12345             3          2 Ergo Keyboard                           5
    12345             3          3 Memory Module 2Gb                      10
    12345             3          4 Processor Dual Core 2.4Ghz              5
    12345             3          5 Dual Output Graphics Card               5
    12345             3          6 28inch LED Monitor                     10
    12345             3          7 Webcam                                  5
    12345             3          8 A3 1200dpi Laser Printer                2
    17 rows selected.Need at least 10.2.0.3 for performance i.e. to avoid COLLECTION ITERATOR PICKLER FETCH in execution plan...
    On 10.2.0.1:
    Execution Plan
    Plan hash value: 3741473841
    | Id  | Operation                          | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   1 |  NESTED LOOPS                      |                        | 24504 |    89M|   873   (1)| 00:00:11 |
    |   2 |   NESTED LOOPS                     |                        |     3 | 11460 |   805   (1)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL               | CUST_ORDER_TBL         |     1 |  3777 |     3   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN                | SYS_IOT_TOP_774117     |     3 |   129 |     1   (0)| 00:00:01 |
    |   5 |   COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |       |
    Predicate Information (identified by operation id):
       4 - access("NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
           filter("SYS_NC_TYPEID$" IS NOT NULL)
    Note
       - dynamic sampling used for this statementOn 10.2.0.3:
    Execution Plan
    Plan hash value: 1048233240
    | Id  | Operation               | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   1 |  NESTED LOOPS           |                   |    17 |   132K|   839   (0)| 00:00:11 |
    |   2 |   MERGE JOIN CARTESIAN  |                   |    17 |   131K|   805   (0)| 00:00:10 |
    |   3 |    TABLE ACCESS FULL    | CUST_ORDER_TBL    |     1 |  3781 |     3   (0)| 00:00:01 |
    |   4 |    BUFFER SORT          |                   |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_56154 |    17 | 70839 |   802   (0)| 00:00:10 |
    |*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_56152 |     1 |    43 |     2   (0)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN     | SYS_C006701       |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - filter("SYS_NC_TYPEID$" IS NOT NULL)
       6 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
           filter("SYS_NC_TYPEID$" IS NOT NULL AND
                  "NESTED_TABLE_ID"="CUST_ORDER_TBL"."SYS_NC0000900010$")
       7 - access("SYS_NTpzENS1H/RwSSC7TVzvlqmQ=="."NESTED_TABLE_ID"="SYS_NTnN5b8Q+8Txi9V
                  w5Ysl6x9w=="."SYS_NC0000600007$")
    Note
       - dynamic sampling used for this statement----------------------------------------------------------------------------------------------------------
    -- CLEAN UP
    DROP TABLE CUST_ORDER_TBL purge;
    exec dbms_xmlschema.deleteschema('http://xmlns.example.org/xsd/testcase.xsd');

  • Problem in creating XMLTYPE table using schema validation

    Hi All,
    While executing  the follwing script there is an error :
    Script : " CREATE TABLE FINAPI_ONLINE_SEC_LOGIN_TMP1 OF  
                  SYS.XMLTYPE XMLSCHEMA
                  "http://www.finnone.com/xsd/TransactionDataRequest.xsd"
                   ELEMENT "transactiondatarequest"
    Error is :
    ERROR at line 1:
    "ORA-31000: Resource 'http://www.finnone.com/xsd/BaseSchema.xsd' is not an XDB schema document"
    why this problem is coming though transactiondatarequest.xsd is reguisterd
    Regards,
    Vikas Kumar

    Check with XMLSpy, JDeveloper or for instance use http://tools.decisionsoft.com/schemaValidate/
    Some pointers to start:
    SQL> conn marco/marco
    Connected.
    SQL> select * from session_roles;
    -- Quick and Dirty: grant xdbadmin, dba to marco
    ROLE
    XDB_WEBSERVICES
    XDB_WEBSERVICES_WITH_PUBLIC
    XDB_WEBSERVICES_OVER_HTTP
    DBA
    SELECT_CATALOG_ROLE
    HS_ADMIN_ROLE
    EXECUTE_CATALOG_ROLE
    DELETE_CATALOG_ROLE
    EXP_FULL_DATABASE
    IMP_FULL_DATABASE
    DATAPUMP_EXP_FULL_DATABASE
    ROLE
    DATAPUMP_IMP_FULL_DATABASE
    GATHER_SYSTEM_STATISTICS
    SCHEDULER_ADMIN
    WM_ADMIN_ROLE
    JAVA_ADMIN
    JAVA_DEPLOY
    XDBADMIN
    XDB_SET_INVOKER
    OLAP_XS_ADMIN
    OLAP_DBA
    21 rows selected.
    SQL> set pages 5000
    SQL> set long 1000000000
    SQL> set trimspool on
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    SQL> desc dba_xml_schemas
    Name                                      Null?    Type
    OWNER                                              VARCHAR2(30)
    SCHEMA_URL                                         VARCHAR2(700)
    LOCAL                                              VARCHAR2(3)
    SCHEMA                                             SYS.XMLTYPE
    INT_OBJNAME                                        VARCHAR2(4000)
    QUAL_SCHEMA_URL                                    VARCHAR2(2839)
    HIER_TYPE                                          VARCHAR2(11)
    BINARY                                             VARCHAR2(3)
    SCHEMA_ID                                          RAW(16)
    HIDDEN                                             VARCHAR2(3)
    SQL> select OWNER, SCHEMA_URL, BINARY
      2  from dba_xml_schemas
      3 
    SQL> col SCHEMA_URL for a80
    SQL> set lines 200
    SQL> select OWNER, SCHEMA_URL, BINARY
      2  from dba_xml_schemas
      3  ;
    OWNER                          SCHEMA_URL                                                                       BIN
    XDB                            http://xmlns.oracle.com/xdb/XDBStandard.xsd                                      NO
    XDB                            http://xmlns.oracle.com/xdb/log/xdblog.xsd                                       NO
    XDB                            http://xmlns.oracle.com/xdb/log/ftplog.xsd                                       NO
    XDB                            http://xmlns.oracle.com/xdb/log/httplog.xsd                                      NO
    XDB                            http://www.w3.org/2001/xml.xsd                                                   NO
    XDB                            http://xmlns.oracle.com/xdb/xmltr.xsd                                            NO
    XDB                            http://xmlns.oracle.com/xdb/XDBFolderListing.xsd                                 NO
    XDB                            http://www.w3.org/1999/xlink.xsd                                                 NO
    XDB                            http://www.w3.org/1999/csx.xlink.xsd                                             YES
    XDB                            http://www.w3.org/2001/XInclude.xsd                                              NO
    XDB                            http://www.w3.org/2001/csx.XInclude.xsd                                          YES
    XDB                            http://xmlns.oracle.com/xdb/stats.xsd                                            NO
    XDB                            http://xmlns.oracle.com/xdb/xdbconfig.xsd                                        YES
    SYS                            kuscomm.xsd                                                                      NO
    SYS                            kusindxt.xsd                                                                     NO
    SYS                            kusindex.xsd                                                                     NO
    SYS                            kuscnstr.xsd                                                                     NO
    SYS                            kusrlsct.xsd                                                                     NO
    SYS                            kusrlsc.xsd                                                                      NO
    XDB                            http://xmlns.oracle.com/xdb/XDBSchema.xsd                                        NO
    XDB                            http://xmlns.oracle.com/xdb/XDBResource.xsd                                      NO
    XDB                            http://www.w3.org/2001/csx.xml.xsd                                               YES
    XDB                            http://xmlns.oracle.com/xdb/csx.xmltr.xsd                                        YES
    XDB                            http://xmlns.oracle.com/xdb/acl.xsd                                              YES
    XDB                            http://xmlns.oracle.com/xdb/dav.xsd                                              YES
    XDB                            http://xmlns.oracle.com/xdb/XDBResConfig.xsd                                     YES
    SYS                            kusrlsgt.xsd                                                                     NO
    SYS                            kustrigt.xsd                                                                     NO
    SYS                            kustrig.xsd                                                                      NO
    SYS                            kusviewt.xsd                                                                     NO
    SYS                            kusview.xsd                                                                      NO
    SYS                            kususert.xsd                                                                     NO
    SYS                            kususer.xsd                                                                      NO
    SYS                            http://xmlns.oracle.com/streams/schemas/lcr/streamslcr.xsd                       NO
    SYS                            kusrlsg.xsd                                                                      NO
    SYS                            kusrlspt.xsd                                                                     NO
    SYS                            kusrlsp.xsd                                                                      NO
    SYS                            kusrolet.xsd                                                                     NO
    SYS                            kusrole.xsd                                                                      NO
    SYS                            kusseqt.xsd                                                                      NO
    SYS                            kusseq.xsd                                                                       NO
    SYS                            kussynt.xsd                                                                      NO
    SYS                            kussyn.xsd                                                                       NO
    SYS                            kustblst.xsd                                                                     NO
    SYS                            kustbls.xsd                                                                      NO
    SYS                            kustablt.xsd                                                                     NO
    SYS                            kustable.xsd                                                                     NO
    SYS                            kusclust.xsd                                                                     NO
    SYS                            kusclus.xsd                                                                      NO
    SYS                            kusctxt.xsd                                                                      NO
    SYS                            kusctx.xsd                                                                       NO
    SYS                            kusdblkt.xsd                                                                     NO
    SYS                            kusdblk.xsd                                                                      NO
    SYS                            kusfgat.xsd                                                                      NO
    SYS                            kusfga.xsd                                                                       NO
    SYS                            kusmvt.xsd                                                                       NO
    SYS                            kusmv.xsd                                                                        NO
    SYS                            kusmvlt.xsd                                                                      NO
    SYS                            kusmvl.xsd                                                                       NO
    SYS                            kusquet.xsd                                                                      NO
    SYS                            kusque.xsd                                                                       NO
    SYS                            kusquetbt.xsd                                                                    NO
    SYS                            kusquetb.xsd                                                                     NO
    ORDSYS                         http://xmlns.oracle.com/ord/meta/exif                                            NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/rpdatatype_1_0                                 NO
    ORDSYS                         http://xmlns.oracle.com/ord/meta/ordimage                                        NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/datatype_1_0                                   NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/mddatatype_1_0                                 NO
    XDB                            http://xmlns.oracle.com/xs/dataSecurity.xsd                                      YES
    XDB                            http://xmlns.oracle.com/xs/aclids.xsd                                            NO
    XDB                            http://xmlns.oracle.com/xs/principal.xsd                                         YES
    XDB                            http://xmlns.oracle.com/xs/roleset.xsd                                           NO
    XDB                            http://xmlns.oracle.com/xs/securityclass.xsd                                     YES
    ORDSYS                         http://xmlns.oracle.com/ord/meta/dicomImage                                      NO
    EXFSYS                         http://xmlns.oracle.com/rlmgr/rclsprop.xsd                                       NO
    EXFSYS                         http://xmlns.oracle.com/rlmgr/rulecond.xsd                                       NO
    ORDSYS                         http://xmlns.oracle.com/ord/meta/iptc                                            NO
    ORDSYS                         http://xmlns.oracle.com/ord/meta/xmp                                             NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/anonymity_1_0                                  NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/constraint_1_0                                 NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/metadata_1_0                                   NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/mapping_1_0                                    NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/preference_1_0                                 NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/privateDictionary_1_0                          NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/standardDictionary_1_0                         NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/orddicom_1_0                                   NO
    ORDSYS                         http://xmlns.oracle.com/ord/dicom/UIDdefinition_1_0                              NO
    MDSYS                          http://www.w3.org/1999/xlink/xlinks.xsd                                          NO
    MDSYS                          http://www.opengis.net/gml/geometry.xsd                                          NO
    MDSYS                          http://www.opengis.net/gml/feature.xsd                                           NO
    MDSYS                          http://xmlns.oracle.com/spatial/georaster/georaster.xsd                          NO
    91 rows selected.
    SQL> set lines 80
    SQL> desc path_view
    Name                                      Null?    Type
    PATH                                               VARCHAR2(1024)
    RES                                                SYS.XMLTYPE(XMLSchema "http:
                                                        //xmlns.oracle.com/xdb/XDBRe
                                                        source.xsd" Element "Resourc
                                                        e")
    LINK                                               SYS.XMLTYPE
    RESID                                              RAW(16)
    SQL> desc resource_view
    Name                                      Null?    Type
    RES                                                SYS.XMLTYPE(XMLSchema "http:
                                                        //xmlns.oracle.com/xdb/XDBRe
                                                        source.xsd" Element "Resourc
                                                        e")
    ANY_PATH                                           VARCHAR2(4000)
    RESID                                              RAW(16)
    SQL> select *
      2  from path_view
      3  where rownum <= 1;
    PATH
    RES
    LINK
    RESID
    /OLAP_XDS
    <Resource xmlns="http://xmlns.oracle.com/xdb/XDBResource.xsd">
      <CreationDate>2007-10-29T14:59:01.968000</CreationDate>
      <ModificationDate>2007-10-29T14:59:02.281000</ModificationDate>
      <DisplayName>OLAP_XDS</DisplayName>
      <Language>en-US</Language>
      <CharacterSet>UTF-8</CharacterSet>
      <ContentType>application/octet-stream</ContentType>
      <RefCount>1</RefCount>
    </Resource>
    <LINK>
      <ParentName>/</ParentName>
      <ChildName>OLAP_XDS</ChildName>
      <Name>OLAP_XDS</Name>
      <Flags>AAAABA==
    </Flags>
      <ParentOid>C4LJcGdKQ3+9zJ4w9efpxQ==
    </ParentOid>
      <ChildOid>8yNpXjvxQJeoruzx3GXRlQ==
    </ChildOid>
      <LinkType>Hard</LinkType>
    </LINK>
    F323695E3BF14097A8AEECF1DC65D195
    SQL> select *
      2  from resource_view
      3  where rownum <= 1;
    RES
    ANY_PATH
    RESID
    <Resource xmlns="http://xmlns.oracle.com/xdb/XDBResource.xsd">
      <CreationDate>2007-10-29T14:59:01.968000</CreationDate>
      <ModificationDate>2007-10-29T14:59:02.281000</ModificationDate>
      <DisplayName>OLAP_XDS</DisplayName>
      <Language>en-US</Language>
      <CharacterSet>UTF-8</CharacterSet>
      <ContentType>application/octet-stream</ContentType>
      <RefCount>1</RefCount>
    </Resource>
    /OLAP_XDS
    F323695E3BF14097A8AEECF1DC65D195
    SQL> select any_path from resource_view
      2  where any_path like '%xsd%';
    ANY_PATH
    /public/root.xsd
    /sys/schemas/PUBLIC/www.opengis.net/gml/feature.xsd
    /sys/schemas/PUBLIC/www.opengis.net/gml/geometry.xsd
    SQL> select xdbURIType ('/public/root.xsd').getClob() from dual;
    XDBURITYPE('/PUBLIC/ROOT.XSD').GETCLOB()
    <?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:element name="ROOT" xdb:defaultTable="ROOT_TABLE" xdb:maintainDOM="false">
                    <xs:annotation>
                            <xs:documentation>Example XML Schema</xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                            <xs:sequence>
                                    <xs:element name="ID" type="xs:integer" xdb:SQLName="ID"/>
                                    <xs:element ref="INFO"/>
                            </xs:sequence>
                    </xs:complexType>
            </xs:element>
            <xs:element name="INFO" xdb:defaultTable="INFO_TABLE" xdb:SQLName="INFO_TYPE">
                    <xs:complexType>
                            <xs:sequence>
                                    <xs:element name="INFO_ID" type="xs:integer" xdb:SQLName="TYPE_INFO_ID"/>
                                    <xs:element name="INFO_CONTENT" xdb:SQLType="CLOB"
                    xdb:SQLName="TYPE_INFO_CONTENT" type="xs:string"/>
                            </xs:sequence>
                    </xs:complexType>
            </xs:element>
    </xs:schema>
    SQL> select s.xmldata.schema_owner, s.xmldata.schema_url, s.xmldata.TARGET_NAMESPACE
      2  from xdb.xdb$schema s
      3  where rownum < 5;
    XMLDATA.SCHEMA_OWNER
    XMLDATA.SCHEMA_URL
    XMLDATA.TARGET_NAMESPACE
    XDB
    http://xmlns.oracle.com/xdb/XDBStandard.xsd
    http://xmlns.oracle.com/xdb/XDBStandard
    XDB
    http://xmlns.oracle.com/xdb/log/xdblog.xsd
    http://xmlns.oracle.com/xdb/log
    XDB
    http://xmlns.oracle.com/xdb/log/ftplog.xsd
    http://xmlns.oracle.com/xdb/log
    XDB
    http://xmlns.oracle.com/xdb/log/httplog.xsd
    http://xmlns.oracle.com/xdb/log
    4 rows selected.
    -- Author     : Mark Drake
    -- Purpose    : Compiling XML Schema
    -- Altered    : Marco Gralike
    -- Date       : 09/02/2007
    -- Alteration : Different, simplified error handling
    -- URL        : http://www.liberidu.com/blog/?p=57
    SET echo ON
    -- spool compileSchemas.log
    -- connect &USERNAME/&PASSWORD
    -- set serveroutput on
    declare
    cursor getSchemaList IS
      SELECT schema_url
      FROM user_xml_schemas;
    begin
    FOR schema IN getSchemaList
    loop
      begin
        dbms_output.put_line('Processing : ' || schema.schema_url);
        dbms_xmlschema.compileSchema(schema.schema_url);
        dbms_output.put_line('Compiled');
      exception when others then
        dbms_output.put_line('Failed ('||SQLCODE||'): ' ||SQLERRM);
      end;
    end loop;
    end;
    -- --------------------------------------------------------etc, etc, etc.
    By the way IMHO there are no stupid questions, only stupid answer, and the learning curve on XMLDB is steep, so if I sometimes look back on my answers...
    Message was edited by:
    Marco Gralike

Maybe you are looking for