XML stored as object relational fails

We are looking at implementing a system to store Universal Business Language (UBL) 1.0 XML invoices in an XMLType column in 10g. I've registered all the requisite schemas (the UBL invoice comprises a rather complicated hierarchy of 19 individual namespaces), but when I come to create the table:
CREATE TABLE UBLInvoices (
invoice_id NUMBER,
invoice_spec XMLTYPE)
XMLTYPE invoice_spec STORE AS OBJECT RELATIONAL
XMLSCHEMA "Invoice-1.0"
ELEMENT "Invoice";
I get an error message to the effect that a table with more than 1000 columns cannot be created. I can create the table using CLOB storage (STORE AS CLOB) without any problems. Is there a limit to the complexity of typed XMLType column schema? Is there any workaround?

As A Non says, why is it unacceptable?
It's only unacceptable to you, but it's not unacceptable XML. The standard of XML does not require a display format as the purpose of XML is to define a structure of data, not to present itself nicely to you on the screen.
If you want to prettify your XML, that's up to you, but optimised XML data does not have formatting, which takes up additional and unnecessary storage space.

Similar Messages

  • Querying XML data in  Object Relational tables

    Hi,
    Can someone help me?
    I have registered the purchaseorder.xsd in my database schema.
    [ http://www.oracle.com/technology/oramag/oracle/03-jul/o43xml.html ]
    declare
    l_bfile bfile;
    begin
    l_bfile := bfilename(
    'XMLSAMP', 'purchaseOrder.xsd');
    dbms_lob.open(l_bfile);
    dbms_xmlschema.registerschema('http://localhost:8080/purchaseOrder.xsd', l_bfile);
    dbms_lob.close(l_bfile);
    end;
    This has created a table "PURCHASEORDER"
    SYS_NC_ROWINFO$ SYS.XMLTYPE
    It has also created object types.
    select object_name from user_objects where object_type = 'TYPE' and object_name like 'XDBPO%'
    XDBPO_ACTIONS_TYPE
    XDBPO_ACTION_COLLECTION
    XDBPO_ACTION_TYPE
    XDBPO_LINEITEMS_TYPE
    XDBPO_LINEITEM_TYPE
    XDBPO_PART_TYPE
    XDBPO_REJECTION_TYPE
    XDBPO_SHIPINSTRUCTIONS_TYPE
    XDBPO_TYPE
    I have also inserted an xml into that table.
    INSERT INTO "PURCHASEORDER"
    VALUES
    xmltype
    getFileContent('ADAMS-20011127121040988PST.xml','XMLSAMP')
    Now how do I retrieve the data from this table and the other object types?
    Is extractvalue the only method? I have gone thru examples in the net but everything uses the element names in xml document and not the object type names.
    For example to retreive the lineitem details, this query can be used
    SELECT extractValue(value(d),'/Description')
    FROM "PURCHASEORDER" p,
    table (xmlsequence(extract(p.SYS_NC_ROWINFO$,'/PurchaseOrder/LineItems/LineItem/Description'))) d
    But I want to retreive it from "XDBPO_LINEITEM_TYPE".
    Is this possible?
    Can someone help me please?
    Thanks in advance.
    Jay

    #1. If you had taken the time to read some of the other posts in the forum all of the answers you needed were all there..
    #2. As PM's we are not expected to spend a lot of time dealing with the forums. In general we are expected only to step in and answer the questions that are not easily answered by carefully reading existing posts or deal with cases were the wrong answer is supplied.
    #3. I'm technically on vacation, and posted to that effect last week, so pushing for an answer is not at all appreciated...
    #4. The problem is extremely simple, at least as stated in your simple example.
    Given the schema.. Note It's been annotated
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
         <xs:element name="Bill">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="InvCtlN"/>
                        <xs:element ref="MedBU"/>
                        <xs:element ref="Lineitem" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvCtlN">
              <xs:simpleType>
                   <xs:restriction base="xs:byte">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="LineCode">
              <xs:simpleType>
                   <xs:restriction base="xs:int">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Lineitem">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Type"/>
                        <xs:element ref="LineCode"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="MedBU">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="SampleFile" xdb:defaultTable="SAMPLE_FILE_TABLE">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Bill" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="Type">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
    </xs:schema>and the following instance
    <SampleFile xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="testcase.xsd">
         <Bill>
              <InvCtlN>1</InvCtlN>
              <MedBU>ABC</MedBU>
              <Lineitem>
                   <Type>P1</Type>
                   <LineCode>99214</LineCode>
              </Lineitem>
         </Bill>
         <Bill>
              <InvCtlN>2</InvCtlN>
              <MedBU>DEF</MedBU>
              <Lineitem>
                   <Type>P2</Type>
                   <LineCode>99215</LineCode>
              </Lineitem>
              <Lineitem>
                   <Type>P3</Type>
                   <LineCode>99216</LineCode>
              </Lineitem>
         </Bill>
         <Bill>
              <InvCtlN>3</InvCtlN>
              <MedBU>HJK</MedBU>
              <Lineitem>
                   <Type>P4</Type>
                   <LineCode>99217</LineCode>
              </Lineitem>
         </Bill>
    </SampleFile>The following appears to be what you are looking for
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:53 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool registerSchema_&4..log
    SQL> set trimspool on
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> declare
      2    result boolean;
      3  begin
      4    result := dbms_xdb.createResource('/home/&1/xsd/&4',
      5                                      bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
      6  end;
      7  /
    old   4:   result := dbms_xdb.createResource('/home/&1/xsd/&4',
    new   4:   result := dbms_xdb.createResource('/home/OTNTEST/xsd/testcase.xsd',
    old   5:                                    bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
    new   5:                                    bfilename(USER,'testcase.xsd'),nls_charset_id('AL32UTF8'));
    PL/SQL procedure successfully completed.
    SQL> commit
      2  /
    Commit complete.
    SQL> alter session set events='31098 trace name context forever'
      2  /
    Session altered.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      schemaURL => '&3',
      5      schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
      6      local     => TRUE,
      7      genTypes  => TRUE,
      8      genBean   => FALSE,
      9      genTables => &5
    10    );
    11  end;
    12  /
    old   4:     schemaURL => '&3',
    new   4:     schemaURL => 'testcase.xsd',
    old   5:     schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
    new   5:     schemaDoc => xdbURIType('/home/OTNTEST/xsd/testcase.xsd').getClob(),
    old   9:     genTables => &5
    new   9:     genTables => TRUE
    PL/SQL procedure successfully completed.
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:55 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool insertFile_&3..log
    SQL> set trimspool on
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> set long 10000
    SQL> --
    SQL> insert into &4 values (xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
      2  /
    old   1: insert into &4 values (xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
    new   1: insert into SAMPLE_FILE_TABLE values (xmltype(bfilename(USER,'testcase.xml'),nls_charset_id('AL32UTF8')
    1 row created.
    Elapsed: 00:00:00.06
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.00
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:55 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase.log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> --
    SQL> -- Testcase code here
    SQL> --
    SQL> set trimspool on
    SQL> set autotrace on explain
    SQL> set timing on
    SQL> set pages 10 lines 160 long 100000
    SQL> --
    SQL> column INVCTLN format  9999
    SQL> column MEDBU   format  A10
    SQL> column TYPE    format  A10
    SQL> column LINECODE format 999999999
    SQL> create or replace view MASTER_TABLE_VIEW
      2  (
      3     INVCTLN,
      4     MEDBU
      5  )
      6  as
      7  select extractValue(value(bill),'/Bill/InvCtlN'),
      8         extractValue(value(bill),'/Bill/MedBU')
      9    from SAMPLE_FILE_TABLE t,
    10         table(xmlsequence(extract(value(t),'/SampleFile/Bill'))) Bill
    11  /
    View created.
    Elapsed: 00:00:00.04
    SQL> create or replace view DETAIL_TABLE_VIEW
      2  (
      3     INVCTLN,
      4     TYPE,
      5     LINECODE
      6  )
      7  as
      8  select extractValue(value(bill),'/Bill/InvCtlN'),
      9         extractValue(value(LineItem),'/Lineitem/Type'),
    10         extractValue(value(LineItem),'/Lineitem/LineCode')
    11    from SAMPLE_FILE_TABLE t,
    12         table(xmlsequence(extract(value(t),'/SampleFile/Bill'))) Bill,
    13         table(xmlsequence(extract(value(bill),'/Bill/Lineitem'))) LineItem
    14  /
    View created.
    Elapsed: 00:00:00.05
    SQL> set autotrace on explain
    SQL> --
    SQL> select * from MASTER_TABLE_VIEW
      2  /
    INVCTLN MEDBU
          1 ABC
          2 DEF
          3 HJK
    Elapsed: 00:00:00.05
    Execution Plan
    Plan hash value: 2362844891
    | Id  | Operation          | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |                    |     3 |  6165 |   805   (1)| 00:00:10 |
    |   1 |  NESTED LOOPS      |                    |     3 |  6165 |   805   (1)| 00:00:10 |
    |*  2 |   TABLE ACCESS FULL| SAMPLE_FILE_TABLE  |     1 |    30 |     3   (0)| 00:00:01 |
    |*  3 |   INDEX RANGE SCAN | SYS_IOT_TOP_159053 |     3 |  6075 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
                  xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
                  http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><rea
                  d-properties/><read-contents/></privilege>'))=1)
       3 - access("NESTED_TABLE_ID"="SAMPLE_FILE_TABLE"."SYS_NC0000800009$")
    Note
       - dynamic sampling used for this statement
    SQL> select * from DETAIL_TABLE_VIEW
      2  /
    INVCTLN TYPE         LINECODE
          1 P1              99214
          3 P4              99217
          2 P2              99215
          2 P3              99216
    Elapsed: 00:00:00.07
    Execution Plan
    Plan hash value: 971642473
    | Id  | Operation               | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |                    |     4 |  8352 |   813   (0)| 00:00:10 |
    |   1 |  NESTED LOOPS           |                    |     4 |  8352 |   813   (0)| 00:00:10 |
    |   2 |   MERGE JOIN CARTESIAN  |                    |     4 |  8220 |   805   (0)| 00:00:10 |
    |*  3 |    TABLE ACCESS FULL    | SAMPLE_FILE_TABLE  |     1 |    30 |     3   (0)| 00:00:01 |
    |   4 |    BUFFER SORT          |                    |     4 |  8100 |   802   (0)| 00:00:10 |
    |   5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_159055 |     4 |  8100 |   802   (0)| 00:00:10 |
    |*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_159053 |     1 |    33 |     2   (0)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN     | SYS_C0022871       |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
                  xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
                  http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-pro
                  perties/><read-contents/></privilege>'))=1)
       6 - access("NESTED_TABLE_ID"="SYS_NTh/v83GzKQ1evte63P5QRog=="."SYS_NC0000700008$")
           filter("NESTED_TABLE_ID"="SAMPLE_FILE_TABLE"."SYS_NC0000800009$")
       7 - access("NESTED_TABLE_ID"="SYS_NTh/v83GzKQ1evte63P5QRog=="."SYS_NC0000700008$")
    Note
       - dynamic sampling used for this statement
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    C:\xdb\otn\362337>

  • Yes, I want to create object-relational schema from DTD.

    Thank you for reply~~
    I want to create object-relational schema from DTD using object type or collections as mentioned.
    In reply, it is impossible.
    But, I read Oracle supports storing an XML document with object-relation. I executed storing sample, but I had to create schema manually.
    Is it really impossible to create OR schema from DTD automatically?

    Yes. You need to create your database schema before insert XML data to it.

  • Can you use Object Relational SQL to access XML content ?

    Is there a possibility to use the generated object types and collection types to conveniently access the xml data?

    Technically there is nothing to prevent you from using the object types generared when an XML Schema is registered to access and manipulate the contents of the instance documents that conform to the Schema. This would be done using the notation x.xmldata.attribute In this case x would be the object table, xmldata is the name of the instance of the SQL object type associated with the table in question.
    However we do not encourage or recommend this approach. Currently XML DB provides the application developer with DML / DDL independence. This holds true as long as you use XPATH expressions to express your DML operations. Using XPATH expressions to access the content of an XML document maintains an abstraction between the DML (XPATH) and the underlying Object Relational Storage Structure derived from the information in the corresponding XML Schema. Whereever possible, when you express a query using an XPATH expression, under the covers we attempt to re-write the query into Object Relational SQL, based on the meta data contained in the Schema, as access v
    If you use the object notation to access the content of the document you break this abstraction. Your application now needs to be aware of the physical (object relational) storage model being used to manage the instance documents.
    One of the key features of XML DB is that it allow a developer to use Schema Annotations to alter the storage model used to manage the instance documents. The most common example of this is using annotations to control the way in which collections are managed. Depending on the annotation in the schema you can store collections as a VARRAY, as a NestedTable or as a separate XMLType table. Dependong on the technique chosed the objects that are generated during the XML Schema registration process will change.
    If you use the XPATH expressions to accesss the content of your documents, and you decided to change the annotations in your schema so as to revise the way your documents are stored, XML DB will ensure your code should continue to work unchanged, regardless of which objects are generated during Schema registration. On the other hand, if you use the object notation to access the content of the documents, and then change the annotation you will have to change your code.
    I hope this clarifies the situation..

  • Reading of relation BuilStandardAddressRel to object BuilEmp failed

    Hi All,
          I am getting this message "Reading of relation BuilStandardAddressRel to object BuilEmp failed" in CRM IC Webclient. The error message is related to Genil Layer. If anybody has encountered this error message or has some pointers please do help.
    Thanks & Regards,
    Rahul.

    Hi Rahul,
    Did you find the solution to this issue as I am getting this error when confirming an employee in the identify employee step?
    Thanks,
    Ian.

  • Validating XML stored in CLOB without exceptions for malformed XML

    Hello,
    I have a CLOB column that should contain an XML which conforms to a registered XSD schema. However, there might also be cases, in which the CLOB content violates the XSD or is not even wellformed XML at all.  Now I am trying to find a way to either
    identify all records, for which the CLOB contains well-formed XML that validates against my schema (find all "good" records) , or
    find all the other records (those with either no XML at all, malformed XML, or XML that does not validate against the XSD) (find all "exceptions")
    The problem is that all XML-validation methods I know of (e.g. isXmlValid or XmlType.isSchemaValid)  require an XmlType instance, and that records, for which no proper XmlType can be constructed from the CLOB, because the CLOB does not contain well-formed XML, will cause an exception, rather than just returning false or NULL or something else I could filter out.
    Is there a way to do something like
    SELECT * FROM MYTABLE where <MY_XML_COL is wellformed XML> and <MY_XML_COL validates against 'blabla.xsd'>
    without getting an ORA-31011 or whatever other kind of exception as soon as there is a row that does not contain proper XML?
    Thank you...

    So here is my example - this will be quiet a long post now...
    First, I create the table with the CLOBs
    CREATE TABLE ZZZ_MINITEST_CLOB (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_DOC CLOB,
      REMARKS VARCHAR2(1000),
      CONSTRAINT PK_ZZZ_MINITEST_CLOB PRIMARY KEY (ID)
    ) NOLOGGING;
    Then I insert some examples
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    10,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>one.one</l2Name>
      </l2Node>
      <minitestId>1</minitestId>
      <minitestName>One</minitestName>
    </minitest_root>',
    'Basic valid example');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    20,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>two.one</l2Name>
      </l2Node>
      <minitestId>2</minitestId>
      <!-- minitestName element is missing -->
    </minitest_root>',
    'Invalid - minitestName element is missing');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    30,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>three.one</l2Name>
      </l2Node>
      <!-- minitestName and minitestId are switched -->
      <minitestName>Three</minitestName>
      <minitestId>3</minitestId>
    </minitest_root>',
    'Invalid - minitestName and minitestId are switched');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    40,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>four.one</l2Name>
      </l2Node>
      <l2Node>
      <l2Num>2</l2Num>
      <l2Name>four.two</l2Name>
      </l2Node>
      <l2Node>
      <l2Num>3</l2Num>
      <l2Name>four.three</l2Name>
      </l2Node>
      <minitestId>4</minitestId>
      <minitestName>Four</minitestName>
    </minitest_root>',
    'Valid - multiple l2Node elements');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    50,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>five.one</l2Name>
      </l2Node>
      <l2Node>
      <l2Num>2</l2Num>
      <l2Name>five.two</l2Name>
      </l2Node>
      <minitestId>4</minitestId>
      <minitestName>Five</minitestName>
      <!-- another l2Node node, but too far down -->
      <l2Node>
      <l2Num>3</l2Num>
      <l2Name>five.three</l2Name>
      </l2Node>
    </minitest_root>',
    'Invalid - another l2Node node, but too far down');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    60,
    'something that is not even xml',
    'Invalid - something that is not even xml');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    70,
    NULL,
    'Invalid - good old NULL');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    80,
    '<minitest_root>
      <l2Node>
      <l2Num>1</l2Num>
      <l2Name>
      <unexpected_node>
      this one should not be here!
      </unexpected_node>
      </l2Name>
      </l2Node>
      <minitestId>8</minitestId>
      <minitestName>Eight</minitestName>
    </minitest_root>',
    'Invalid - unexpected addl node');
    INSERT INTO ZZZ_MINITEST_CLOB VALUES (
    90,
    '<something> that has tags but is no xml </either>',
    'Invalid - something that has tags but is no xml either');
    COMMIT;
    Next I register the XSD...
    BEGIN
    DBMS_XMLSCHEMA.REGISTERSCHEMA(
      'http://localhost/minitest.xsd',
      '<?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:oraxdb="http://xmlns.oracle.com/xdb" oraxdb:storeVarrayAsTable="true" oraxdb:schemaURL="http://localhost/minitest.xsd">
      <xs:element name="minitest_root" oraxdb:SQLName="MINITEST_ROOT" oraxdb:SQLType="MINITEST_TYPE" oraxdb:defaultTable="" oraxdb:tableProps="NOLOGGING" oraxdb:maintainDOM="false">
        <xs:complexType oraxdb:SQLType="MINITEST_TYPE" oraxdb:maintainDOM="false">
          <xs:sequence>
            <xs:element maxOccurs="unbounded" ref="l2Node" oraxdb:SQLName="L2_NODE" oraxdb:SQLType="L2_NODE_TYPE" oraxdb:SQLCollType="L2_NODE_COLL" oraxdb:maintainDOM="false"/>
            <xs:element ref="minitestId" oraxdb:SQLName="MINITEST_ID" oraxdb:SQLType="NUMBER" oraxdb:maintainDOM="false"/>
            <xs:element ref="minitestName" oraxdb:SQLName="MINITEST_NAME" oraxdb:SQLType="VARCHAR2" oraxdb:maintainDOM="false"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="l2Node" oraxdb:SQLName="L2_NODE" oraxdb:SQLType="L2_NODE_TYPE" oraxdb:defaultTable="" oraxdb:tableProps="TABLESPACE CATALOG NOLOGGING" oraxdb:maintainDOM="false">
        <xs:complexType oraxdb:SQLType="L2_NODE_TYPE" oraxdb:maintainDOM="false">
          <xs:sequence>
            <xs:element ref="l2Num" oraxdb:SQLName="L2_NUM" oraxdb:SQLType="NUMBER" oraxdb:maintainDOM="false"/>
            <xs:element ref="l2Name" oraxdb:SQLName="L2_NAME" oraxdb:SQLType="VARCHAR2" oraxdb:maintainDOM="false"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="l2Num" type="number10_0Type" oraxdb:SQLName="L2_NUM" oraxdb:SQLType="NUMBER" oraxdb:maintainDOM="false" />
      <xs:element name="l2Name" type="varchar100Type" oraxdb:SQLName="L2_NAME" oraxdb:SQLType="VARCHAR2" oraxdb:maintainDOM="false" />
      <xs:element name="minitestId" type="number10_0Type" oraxdb:SQLName="MINITEST_ID" oraxdb:SQLType="NUMBER" oraxdb:maintainDOM="false" />
      <xs:element name="minitestName" type="varchar100Type" oraxdb:SQLName="MINITEST_NAME" oraxdb:SQLType="VARCHAR2" oraxdb:maintainDOM="false" />
      <xs:simpleType name="varchar100Type">
        <xs:restriction base="xs:string">
          <xs:maxLength value="100"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType name="number10_0Type">
        <xs:restriction base="xs:integer">
          <xs:totalDigits value="10"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>',
      GENTABLES=>FALSE
    END;
    And then I create my XML tables - four different ones for four different test cases. I am trying unstructured binary XML and strucured OR-based XML, each with and without a trigger.
    One with structured OR storage and no trigger
    CREATE TABLE ZZZ_MINITEST_ORXML (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_CONTENT XMLTYPE,
      CONSTRAINT PK_ZZZ_MINITEST_ORXML PRIMARY KEY (ID)
    ) NOLOGGING
    VARRAY "XML_CONTENT"."XMLDATA"."L2_NODE" STORE AS TABLE "ZZZ_OR_L2_NODE" (NOLOGGING) RETURN AS LOCATOR
    XMLTYPE XML_CONTENT STORE AS OBJECT RELATIONAL XMLSCHEMA "http://localhost/minitest.xsd" ELEMENT "minitest_root";
    One with structured OR storage which will also have a trigger added further down
    CREATE TABLE ZZZ_MINITEST_ORXML_TRGR (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_CONTENT XMLTYPE,
      CONSTRAINT PK_ZZZ_MINITEST_ORXML_TRGR PRIMARY KEY (ID)
    ) NOLOGGING
    VARRAY "XML_CONTENT"."XMLDATA"."L2_NODE" STORE AS TABLE "ZZZ_OR_L2_NODE_TRGR" (NOLOGGING) RETURN AS LOCATOR
    XMLTYPE XML_CONTENT STORE AS OBJECT RELATIONAL XMLSCHEMA "http://localhost/minitest.xsd" ELEMENT "minitest_root";
    One with unstructured binary XML in a SECUREFILE, no trigger
    CREATE TABLE ZZZ_MINITEST_BINXML_TRGR (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_CONTENT XMLTYPE,
      CONSTRAINT PK_ZZZ_MINITEST_BINXML_TRGR PRIMARY KEY (ID)
    ) NOLOGGING
    XMLTYPE COLUMN XML_CONTENT STORE AS SECUREFILE BINARY XML
      (NOCOMPRESS NOCACHE NOLOGGING KEEP_DUPLICATES);
    One with unstructured binary XML in a SECUREFILE, which will also have a trigger
    CREATE TABLE ZZZ_MINITEST_BINXML (
      ID NUMBER(10,0) NOT NULL ENABLE,
      XML_CONTENT XMLTYPE,
      CONSTRAINT PK_ZZZ_MINITEST_BINXML PRIMARY KEY (ID)
    ) NOLOGGING
    XMLTYPE COLUMN XML_CONTENT STORE AS SECUREFILE BINARY XML
      (NOCOMPRESS NOCACHE NOLOGGING KEEP_DUPLICATES);
    Then I create the error logging tables
    begin
    DBMS_ERRLOG.CREATE_ERROR_LOG ('ZZZ_MINITEST_BINXML', 'ZZZ_MINITEST_BINXML_E', NULL, NULL, TRUE);
    DBMS_ERRLOG.CREATE_ERROR_LOG ('ZZZ_MINITEST_BINXML_TRGR', 'ZZZ_MINITEST_BINXML_TRGR_E', NULL, NULL, TRUE);
    DBMS_ERRLOG.CREATE_ERROR_LOG ('ZZZ_MINITEST_ORXML', 'ZZZ_MINITEST_ORXML_E', NULL, NULL, TRUE);
    DBMS_ERRLOG.CREATE_ERROR_LOG ('ZZZ_MINITEST_ORXML_TRGR', 'ZZZ_MINITEST_ORXML_TRGR_E', NULL, NULL, TRUE);
    END;
    Now the two triggers
    create or replace trigger TRG_ZZZ_MINITEST_BINXML
    BEFORE UPDATE OR INSERT ON ZZZ_MINITEST_BINXML_TRGR
    REFERENCING NEW AS NEW
    for each row
    BEGIN
      :NEW.XML_CONTENT := :NEW.XML_CONTENT.createSchemaBasedXML('http://localhost/minitest.xsd');
      :NEW.XML_CONTENT.SCHEMAVALIDATE();
    END TRG_ZZZ_MINITEST_BINXML;
    CREATE OR REPLACE TRIGGER TRG_ZZZ_MINITEST_ORXML
    BEFORE UPDATE OR INSERT ON ZZZ_MINITEST_ORXML_TRGR
    REFERENCING NEW AS NEW
    for each row
    BEGIN
      :NEW.XML_CONTENT := :NEW.XML_CONTENT.createSchemaBasedXML('http://localhost/minitest.xsd');
      :NEW.XML_CONTENT.SCHEMAVALIDATE();
    END TRG_ZZZ_MINITEST_ORXML;
    I also tried to just validate the XML using queries such as the below, since validating all without the WHERE also caused exception and abortion:
    SELECT ID, DECODE(XMLISVALID(XMLTYPE(XML_DOC), 'http://localhost/minitest.xsd'), 1, 'Y', 0, 'N', '?') VALID
    FROM ZZZ_MINITEST_CLOB WHERE ID=90;
    The results are in column "VALID" in the below tables
    I tried inserting all records from ZZZ_MINITEST_CLOB into the four test tables at once using a query such as
    INSERT INTO ZZZ_MINITEST_ORXML_TRGR
    SELECT ID, XMLPARSE(DOCUMENT XML_DOC WELLFORMED) FROM ZZZ_MINITEST_CLOB
    LOG ERRORS INTO ZZZ_MINITEST_ORXML_TRGR_E REJECT LIMIT UNLIMITED;
    I also tried different versions of creating the XML in the SELECT portion:
    XMLPARSE(DOCUMENT XML_DOC WELLFORMED)
    XMLPARSE(DOCUMENT XML_DOC WELLFORMED)
    XMLTYPE(XML_DOC)
    XMLTYPE(XMLDOC, 'http://localhost/minitest.xsd', 0, 1)
    Almost all combinations of the four test tables with the four ways to instantiate the XML caused exceptions and query abortion despite the LOG ERRORS INTO clause.
    In order to find the exact problems, I started inserting records one by one using queries like
    INSERT INTO ZZZ_MINITEST_ORXML
    SELECT ID, XMLPARSE(DOCUMENT XML_DOC) FROM ZZZ_MINITEST_CLOB WHERE ID=10
    LOG ERRORS INTO ZZZ_MINITEST_ORXML_E REJECT LIMIT UNLIMITED;
    or
    INSERT INTO ZZZ_MINITEST_BINXML_TRGR
    SELECT ID, XMLTYPE(XMLDOC, 'http://localhost/minitest.xsd', 0, 1) FROM ZZZ_MINITEST_CLOB WHERE ID=20
    LOG ERRORS INTO ZZZ_MINITEST_BINXML_TRGR_E REJECT LIMIT UNLIMITED;
    I captured the results of each in the below four tables. "1" and "0" are number of rows inserted. 0 means there was no record inserted and instead, there was an error logged in the ERROR LOGGING table.
    The ORA-????? exception numbers mean that this error actually caused the INSERT to fail and abort rather than just being logged in the LOGGING TABLE.These are the most critical cases for me. Why do these exceptions "bubble up" forcing the query to be aborted rather than being logged in the error log as well???
    This table is for INSERT of XMLs using XMLTYPE(XML_DOC)
    Test case
    VALID
    Binary XML,
    no trigger
    Binary XML,
    trigger
    OR XML,
    no trigger
    OR XML,
    trigger
    10
    Good
    Y
    1
    1
    1
    1
    20
    no name
    N
    1
    0
    1
    0
    30
    switched tags
    N
    1
    1
    1
    1
    40
    Good
    Y
    1
    1
    1
    1
    50
    L2 down
    N
    1
    1
    1
    1
    60
    no xml
    EX
    ORA-31011
    ORA-31011
    ORA-31011
    ORA-31011
    70
    NULL
    EX
    ORA-06502
    ORA-06502
    ORA-06502
    ORA-06502
    80
    addl. Node
    N
    1
    0
    ORA-31187
    ORA-31187
    90
    crappy xml
    EX
    ORA-31011
    ORA-31011
    ORA-31011
    ORA-31011
    This table is for INSERT of XMLs using XMLTYPE(XML_DOC, 'http://localhost/minitest.xsd', 0, 1)
    Test case
    VALID
    Binary XML,
    no trigger
    Binary XML,
    trigger
    OR XML,
    no trigger
    OR XML,
    trigger
    10
    Good
    Y
    1
    1
    1
    1
    20
    no name
    N
    1
    0
    1
    0
    30
    switched tags
    N
    1
    1
    1
    1
    40
    Good
    Y
    1
    1
    1
    1
    50
    L2 down
    N
    1
    1
    1
    1
    60
    no xml
    EX
    ORA-31043
    ORA-31043
    ORA-31043
    ORA-31043
    70
    NULL
    EX
    ORA-06502
    ORA-06502
    ORA-06502
    ORA-06502
    80
    addl. Node
    N
    1
    0
    ORA-31187
    ORA-31187
    90
    crappy xml
    EX
    ORA-31043
    ORA-31043
    ORA-31043
    ORA-31043
    This table is for INSERT of XMLs using XMLPARSE(DOCUMENT XML_DOC WELLFORMED)
    Test case
    VALID
    Binary XML,
    no trigger
    Binary XML,
    trigger
    OR XML,
    no trigger
    OR XML,
    trigger
    10
    Good
    Y
    1
    1
    1
    1
    20
    no name
    N
    1
    0
    1
    0
    30
    switched tags
    N
    1
    1
    1
    1
    40
    Good
    Y
    1
    1
    1
    1
    50
    L2 down
    N
    1
    1
    1
    1
    60
    no xml
    ORA-31061
    0
    ORA-31011
    ORA-31011
    70
    NULL
    1
    0
    1
    0
    80
    addl. Node
    N
    0
    0
    ORA-31187
    ORA-31187
    90
    crappy xml
    ORA-31061
    0
    ORA-30937
    ORA-30937
    This table is for INSERT of XMLs using XMLPARSE(DOCUMENT XML_DOC) (same as above, but without "WELLFORMED")
    Test case
    VALID
    Binary XML,
    no trigger
    Binary XML,
    trigger
    OR XML,
    no trigger
    OR XML,
    trigger
    10
    Good
    Y
    1
    1
    1
    1
    20
    no name
    N
    1
    0
    1
    0
    30
    switched tags
    N
    1
    1
    1
    1
    40
    Good
    Y
    1
    1
    1
    1
    50
    L2 down
    N
    1
    1
    1
    1
    60
    no xml
    ORA-31011
    ORA-31011
    ORA-31011
    ORA-31011
    70
    NULL
    1
    0
    1
    0
    80
    addl. Node
    N
    1
    0
    ORA-31187
    ORA-31187
    90
    crappy xml
    ORA-31011
    ORA-31011
    ORA-31011
    ORA-31011
    As you can see, different ways to instantiate the XML which is being inserted will cause different results for the most critical cases (60, 80 and 90). One will go through with an error logged in the logging table and no record inserted, others cause exceptions. Also, using XMLPARSE with or without WELLFORMED causes different ORA numbers for record 90...
    It seems like the only way to not get any exceptions for my test records is inserting XMLs that were created using XMLPARSE (DOCUMENT ... WELLFORMED) into the trigger-protected binary XML table. However, that causes me to miss record number 80, which is one that I really need, because it is well formed and I could use XSLTs to fix the XML by removing the extra tags, as long as I know which ones those are.

  • Problem in use xmlgen.insertXML to insert XML file to Object Viewse

    I am trying to update XML file to Object View but it failed. Refer to the steps that I was doing.
    1) Use utl_file.get_line to read XML file which I generated (It is no problem)
    2)The xml data is
    <?xml version="1.0" ?>
    - <ROWSET>
    - <ROW num="1">
    <PK_NO>305</PK_NO>
    <ACC_NAME>PAPERS AND CLIPS</ACC_NAME>
    <FROM_NAME>MB METAL PTE LTD</FROM_NAME>
    <MAS_NO>990015</MAS_NO>
    <MAS_DATE>2000-04-07 15:47:52.0</MAS_DATE>
    <CURR_CODE>SGD</CURR_CODE>
    <MAS_CODE>WRFQ</MAS_CODE>
    <REMARK>SADKJAS</REMARK>
    - <LINEITEMLIST_NTAB>
    - <LINEITEMLIST_NTAB_ITEM>
    <ITEM_NO>1</ITEM_NO>
    <STK_C>2506401</STK_C>
    <SP_STK_C>H282828</SP_STK_C>
    <STK_NAME>STICK-ON-NOTES - 11110 1.5, 12 100 SHEET PADS</STK_NAME>
    <UOM>SET</UOM>
    <QTY>10</QTY>
    <SALES_PRICE>95.50</SALES_PRICE>
    <REMARK>SADKJAS</REMARK>
    </LINEITEMLIST_NTAB_ITEM>
    - <LINEITEMLIST_NTAB_ITEM>
    <ITEM_NO>2</ITEM_NO>
    <STK_C>7706001</STK_C>
    <SP_STK_C>H282828</SP_STK_C>
    <STK_NAME>FACESHIELD/EYE PROT CLEAR GLASS WTR PLATE, STANDARD DREW</STK_NAME>
    <UOM>PCS</UOM>
    <QTY>1</QTY>
    <SALES_PRICE>100</SALES_PRICE>
    <REMARK>SADKJAS</REMARK>
    </LINEITEMLIST_NTAB_ITEM>
    </LINEITEMLIST_NTAB>
    </ROW>
    </ROWSET>
    3) From Object View, I generated xml file is
    - <ROWSET>
    - <ROW num="1">
    <PK_NO>2</PK_NO>
    <ACC_NAME>PAPERS AND CLIPS</ACC_NAME>
    <FROM_NAME>MB METAL PTE LTD</FROM_NAME>
    <MAS_NO>990015</MAS_NO>
    <MAS_DATE>2000-06-07 00:00:00.0</MAS_DATE>
    <CURR_CODE>SGD</CURR_CODE>
    <MAS_CODE>WRFQ</MAS_CODE>
    - <LINEITEMLIST_NTAB>
    - <LINEITEMLIST_NTAB_ITEM>
    <ITEM_NO>1</ITEM_NO>
    <STK_C>2506401</STK_C>
    <STK_NAME>STICK-ON-NOTES - 11110 1.5,X2 12 100 SHEET PADS</STK_NAME>
    <UOM>SET</UOM>
    <QTY>1</QTY>
    <SALES_PRICE>10</SALES_PRICE>
    </LINEITEMLIST_NTAB_ITEM>
    </LINEITEMLIST_NTAB>
    </ROW>
    - <ROW num="2">
    <PK_NO>4</PK_NO>
    <ACC_NAME>ABC</ACC_NAME>
    <FROM_NAME>VBF</FROM_NAME>
    <MAS_NO>99200</MAS_NO>
    <MAS_DATE>2000-01-04 00:00:00.0</MAS_DATE>
    <CURR_CODE>SGD</CURR_CODE>
    <MAS_CODE>DSDS</MAS_CODE>
    <REMARK>WRFQ</REMARK>
    <LINEITEMLIST_NTAB />
    </ROW>
    </ROWSET>
    3) I use INSTEAD OF trigger for Object View to insert the data to database.
    I got the message is:
    ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.sql.OracleXMLSQLException:5.
    Anybody can give me the advise for that.
    null

    If you have the ftp server at 8080 running (9iR2 only) the simples way is to upload it to the database through that server. You can then do whatever you want using the xdburitype() procedure.
    Below is an excerpt of a script I use to register XML schema's (I've got some very long ones, about 150K). It should work with "any" file..
    begin
         dbms_xmlschema.registerSchema (
              schemaURL => 'http://www.agralin.nl/WebQuery/ns/&1',
              schemaDoc => xdburitype('/age/&1..xsd'),
              local => TRUE,
              genTables => FALSE,
              genbean => FALSE,
              genTypes => TRUE,
              force => FALSE,
              owner => 'AGE'
    end;

  • Run-time error '1004' -- Method 'Container' of object '_Workbook' failed

    Dear All,
    One of our users is getting the following Microsoft Visual Basic error while running the report S_ALR_87013614.
    Run-time error '1004'
    Method 'Container' of object '_Workbook' failed.
    I have searched the forum posts for help. But I only found some details related to Run-time error 1004 related to some excel file security but not related to "Method 'Container' of object '_Workbook' failed".
    Could anyone please tell me how this error can be eliminated for the user?
    Regards,
    Lakshmi.

    Dear Arpan,
    We too observed a few PIDs along with the one that you have mentioned but they make no difference. Some users who has the PID G_RW_DOCUMENT_TYPE set with some value are getting the report.
    Upon further searching we are assuming that it could be an issue with the Microsoft applications or macro settings of the user. But not sure about it.
    Regards,
    Lakshmi Venigala.

  • Printing out results in case of object-relational table (Oracle)

    I have made a table with this structure:
    CREATE OR REPLACE TYPE Boat AS OBJECT(
    Name varchar2(30),
    Ident number,
    CREATE OR REPLACE TYPE Type_boats AS TABLE OF Boat;
    CREATE TABLE HOUSE(
    Name varchar2(40),
    MB Type_boats)
    NESTED TABLE MB store as P_Boat;
    INSERT INTO House VALUES ('Name',Type_boats(Boat('Boat1', 1)));
    I am using java to print out all the results by calling a procedure.
    CREATE OR REPLACE package House_boats
    PROCEDURE add(everything works here)
    PROCEDURE results_view;
    END House_boats;
    CREATE OR REPLACE Package.body House_boats AS
    PROCEDURE add(everything works here) AS LANGUAGE JAVA
    Name House_boats.add(...)
    PROCEDURE results_view AS LANGUAGE JAVA
    Name House_boats.resuts_view();
    END House_boats;
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    CALL House_boats.results_view();
    House_boats.java file which is loaded using LOADJAVA:
    import java.sql.*;
    import java io.*;
    public class House_boats {
    public static void results_view ()
       throws SQLException
       { String sql =
       "SELECT * from House";
       try { Connection conn = DriverManager.getConnection
    ("jdbc:default:connection:");
       PreparedStatement pstmt = conn.prepareStatement(sql);
       ResultSet rset = pstmt.executeQuery();
      printResults(rset);
      rset.close();
      pstmt.close();
       catch (SQLException e) {System.err.println(e.getMessage());
    static void printResults (ResultSet rset)
       throws SQLException { String buffer = "";
       try { ResultSetMetaData meta = rset.getMetaData();
       int cols = meta.getColumnCount(), rows = 0;
       for (int i = 1; i <= cols; i++)
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       if (label.length() > size) size = label.length();
       while (label.length() < size) label += " ";
      buffer = buffer + label + " "; }
      buffer = buffer + "\n";
       while (rset.next()) {
      rows++;
       for (int i = 1; i <= cols; i++) {
       int size = meta.getPrecision(i);
       String label = meta.getColumnLabel(i);
       String value = rset.getString(i);
       if (label.length() > size) size = label.length();
       while (value.length() < size) value += " ";
      buffer = buffer + value + " ";  }
      buffer = buffer + "\n";   }
       if (rows == 0) buffer = "No data found!\n";
       System.out.println(buffer); }
       catch (SQLException e) {System.err.println(e.getMessage());}  }
    How do I print out the results correctly in my case of situation?
    Thank you in advance

    I have made a table with this structure:
    I am using java to print out all the results by calling a procedure.
    However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
    How do I print out the results correctly in my case of situation?
    There are several things wrong with your code and methodology
    1. The code you posted won't even compile because there are several syntax issues.
    2. You are trying to use/test Java in the database BEFORE you get the code working outside the DB
    3. Your code is not using collections in JDBC properly
    I suggest that you use a different, proven approach to developing Java code for use in the DB
    1. Use SIMPLE examples and then build on them. In this case that means don't add collections to the example until ALL other aspects of the app work properly.
    2. Create and test the Java code OUTSIDE of the database. It is MUCH easier to work outside the database and there are many more tools to help you (e.g. NetBeans, debuggers, DBMS_OUTPUT windows, etc). Trying to debug Java code after you have already loaded it into the DB is too difficult. I'm not aware of anyone, even at the expert level, that develops that way.
    3. When using complex functionality like collections first read the Oracle documentation (JDBC Developer Guide and Java Developer's Guide). Those docs have examples that are known to work.
    http://docs.oracle.com/cd/B28359_01/java.111/b31225/chfive.htm
    http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraarr.htm#sthref583
    The main issue with your example is #3 above; you are not using collections properly:
    String value = rset.getString(i);
    A collection is NOT a string so why would you expect that to work for a nested table?
    A collection needs to be treated like a collection. You can even treat the collection as a separate result set. Create your code outside the database and use the debugger in NetBeans (or other) on this replacement code for your 'printResults' method:
    static void printResults (ResultSet rset) throws SQLException {
        try {
           ResultSetMetaData meta = rset.getMetaData();
           while (rset.next()) {
               ResultSet rs = rset.getArray(2).getResultSet();
               rs.next();
               String ndx = rs.getString(1);
               Struct struct = (Struct) rs.getObject(2);
               System.out.println(struct.getSQLTypeName());
               Object [] oa = struct.getAttributes();
               for (int j = 0; j < oa.length; j++) {
                  System.out.println(oa[j]);
        } catch  (SQLException e) {
           System.err.println(e.getMessage());
    That code ONLY deals with column 2 which is the nested table. It gets that collection as a new resultset ('rs'). Then it gets the contents of that nested table as an array of objects and prints out the attributes of those objects so you can see them.
    Step through the above code in a debugger so you can SEE what is happening. NetBeans also lets you enter expressions such as 'rs' in an evaluation window so you can dynamically try the different methods to see what they do for you.
    Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
    Since your current issue has nothing to do with this forum I suggest that you mark this thread ANSWERED and repost it in the JDBC forum if you need further help with this issue.
    https://forums.oracle.com/community/developer/english/java/database_connectivity
    When you repost you can include a link to this current thread if you want. Once your Java code is actually working then try the Java Stored procedure examples in the Java Developer's Guide doc linked above.
    At the point you have any issues that relate to Java stored procedures then you should post them in the SQL and PL/SQL forum
    https://forums.oracle.com/community/developer/english/oracle_database/sql_and_pl_sql

  • Need help in Object-Relational Mapping

    I'm writing a simple two-tiered business application with Swing application on the client side and a DBMS on the server side. To make my client code more maintainable, I decided to create Business Objects instead of having my client accessing the database directly via SQL. For simplicity, I'm not using any features from the J2EE framework, and the Business Objects will be hosted on the client side, with one-to-one mapping to tables in the database. Since this is my first attempt in Object-Relational Mapping, I'm faced with the following problems:
    1. What kind of methods are appropriate for business objects? For example, if I have a Machine and Employee entity. A Machine is owned by an employee, and this is represented in the DB by storing the employee ID (not the name) as a foreign key in the Machine table. Let's say in the user interface I have a table that needs to display the list of Machines, but instead of displaying the owner employee's ID, I want to display the owner employee's name by doing a join select. Should the findMachines() method always perform a join select to get owner's name and store it in the Machine object which is returned, or should findMachines() simply return the owner's ID so the UI will need to make another SQL call (through the Employee object) to get the employee's name? The latter is more elegant, but would it be horribly inefficient if there are lots of machines to be displayed (and for each machine we make a separate select call to get the owner's name).

    Business objects should be separate from how they're persisted.
    When you say object-relational mapping, do you mean a tool like Hibernate? Or are you writing your own persistence layer using JDBC and SQL?
    I'd recommend that you read about the Data Access Object pattern and keep the persistence code out of the business objects themselves:
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
    url=http://www-106.ibm.com/developerworks/java/library/j-dao/

  • XML attributes and object types

    I want to create an XML Document of the following form
    <family>
    <parent attr1="val1">
    <child attr2="val2" attr3="val3"/>
    </parent>
    </family>
    Using object table and object type (for the child element), I am able to produce the following XML Document (with a "select * from family" query)
    <family> <!-- rowset -->
    <parent> <!-- row -->
    <attr1>val1</attr1>
    <child>
    <attr2>val2</attr2>
    <attr3>val3</attr3>
    </child>
    </parent>
    </family>
    The question is: how am I going to query these data so that the "attr" elements are mapped to attributes (using XSU only, without XSLT)?
    I have already tried the following:
    1. Using
    SELECT attr1 as "@attr1",
    f.child.attr2 "@attr2",
    f.child.attr3 "@attr3"
    FROM family f
    all the attributes are obviously appended to the "parent" element.
    2. Using nested table for "child" and the following query
    SELECT attr1 as "@attr1",
    CURSOR (
    SELECT n.child.attr2 as "@attr2", n.child.attr3 as "@attr3"
    FROM TABLE(f.child n)
    ) AS "child"
    FROM family f
    I am getting the following document
    <family>
    <parent attr1="val1">
    <child>
    <child_ROW attr2="val2" attr3="val3"/>
    </child>
    </parent>
    </family>
    Is there a smart SQL query to produce the desired document? What data types
    is it recommended to use to define my db schema (object types, nested tables...)?
    Thank you in advance
    null

    Finally, I got the desired XML format output from relational tablse using schema based XMLType views.
    Wherein I created Object Types from relational table, generated the schema for the Object type, registered the schema and finally created XMLType Views for populating the XML data from Relational Tables.
    I guess, you all might aware of my problem, where I got struck. Instead of printing the data in XML format I am successful in generating the XML format data Using the Query Select from BLABLA_Type_view* . I am able to print the number of rows, that I require which is in the fallowing format.
    Column Name
    1. SYS.XMLTYPE ----- As a row
    The view I am querying for is printing the data in a string format, where in I got to do the fallowing query
    SELECT SYS.XMLTYPE.getStringVal(OBJECT_VALUE) FROM BLABLA_Type_view. Which ultimately gave me the required data in XML format with tags.
    Thanks for every one who tried to give a try to solve, especially "mdrake"

  • HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7

    All -
    I'm new to consuming web services in JDeveloper. I'm using Oracle JDEV 10.1.3.3/OC4J.  I'm using this version since it is compatible with Oracle EBS 12.1.3.  My intent is to pull data from our third party recruitment app (Success Factors) and load that data into Oracle HRIS.  I'm already doing this through a .NET application.  I'm converting it to be a Java Concurrent Program in EBS.  The code listed below is a stub call to verify I'm on the right track. I created a JDeveloper Web Services proxy project.  I'm testing it locally on my windows desktop.  When I'm able to consume the service successfully, then I'll think about moving it to the EBS server.
    I'm getting the following error when I invoke the following service:
    HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
    End point is: https://api4.successfactors.com/sfapi/v1/soap?wsdl
    Any help/assistance would be much appreciated. 
    Below is my code and output of my test:
    package emsc.oracle.apps.emscper.sfapi.proxy;
    import HTTPClient.HTTPConnection;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.IsValidSession;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.IsValidSessionResponse;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Login;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LoginResponse;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LoginResult;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Logout;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LogoutResponse;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.SFCredential;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.SFParameter;
    import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Error;
    import java.io.File;
    import javax.xml.rpc.ServiceFactory;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Date;
    import javax.xml.ws.BindingProvider;
    import javax.xml.soap.SOAPException;
    import java.util.Map;
    import oracle.security.ssl.OracleSSLCredential;
    public class SFAPITest {
        // Declare members:      
        private String companyId;
        private String userName;
        private String password;
        private String developerKey;
        private Date   effDt;
        private String greaterThanEffDt;
        private String lessThanEffDt;
        // Declare constants:      
        final static private String breakLine = "+---------------------------------------------------------------------------+";
        final static private String format    = "yyyy-mm-dd";      
        private enum ReqId {
            PrimaryReq(25),
            PrimaryReqCEO(26),
            EmCarePrimary(27),
            RTI(28),
            EmCareClinical(29);
            private int reqId; 
            private ReqId() {
            private ReqId(int value) {
                reqId = value;
            public int getReqId() {
                return reqId;
        // Getters and Setters:  
        protected String getCompanyId() {
           return this.companyId;
        protected void setCompanyId(String value) {
           this.companyId = value;                 
        protected String getUserName() {
           return this.userName;
        protected void setUserName(String value) {
           this.userName = value;                 
        protected String getPassword() {
           return this.password;
        protected void setPassword(String value) {
           this.password = value;                 
        protected String getDeveloperKey() {
           return this.developerKey;
        protected void setDeveloperKey(String value) {
           this.developerKey = value;                 
        protected Date getEffDt() {
            return this.effDt;
        protected void setEffDt(Date value) {
            this.effDt = value;                 
        protected String getGreaterThanEffDt() {
           return this.greaterThanEffDt;
        protected void setGreaterThanEffDt(String value) {
           this.greaterThanEffDt = value;                 
        protected String getLessThanEffDt() {
           return this.lessThanEffDt;
        protected void setLessThanEffDt(String value) {
           this.lessThanEffDt = value;                 
        public void runProgram()
            SFAPIService mySFAPIService;
            String CompletionText = "";
            String effDtStr2 = null;
        /* Code your program logic here.
        * Use getJDBCConnection method to get the connection object for any
        * JDBC operations.
        * Use CpContext provided commit,rollback methods to commit/rollback
        * data base transactions.
        * Don't forget to release the connection before returning from this
        * method.
        /* Call setCompletion method to set the request completion status and
        * completion text.
        * Status values are ReqCompletion.NORMAL,ReqCompletion.WARNING,
        * ReqCompletion.ERROR.
        * Use Completion text message of length 240 characters. If it is more
        * than 240 then full string will appear in log file and truncated 240
        * characters will be used as request completion text.
        try
            ServiceFactory factory = ServiceFactory.newInstance();
            mySFAPIService = (emsc.oracle.apps.emscper.sfapi.proxy.SFAPIService)factory.loadService(emsc.oracle.apps.emscper.sfapi.proxy.SFAPIService.class);      
            SFAPI api = mySFAPIService.getSFAPI();
           /// SFAPI api = new SFAPI();
            //Map<String, Object> requestContext = ((BindingProvider) api).getRequestContext();
            //requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
            System.out.println("ServiceName => " + mySFAPIService.getServiceName().toString());
            System.out.println("End Point   => " + mySFAPIService.getServiceName().toString());
            System.out.println(breakLine);
            // Authentication: Login to SFAPI:
            SFCredential credential = new SFCredential();
            // Fake credentials being passed in for this post:   
            credential.setCompanyId("XXX");
            credential.setUsername("XXX");
            credential.setPassword("XXX");
            credential.setDeveloperKey("XXX");
            HTTPConnection httpsConnection = null;       
            OracleSSLCredential _credential = new OracleSSLCredential();      
            _credential.setWallet("\\\\\\C:\\Program Files\\Java\\jdk1.6.0_33\\jre\\lib\\security", "ParkEstes3");
            /*System.setProperty("javax.net.ssl.trustStore","C:\\\\\OraHome_1\\jdev\\jdevbin\\jdk\\jre\\lib\\security\\keystore");
            System.setProperty("javax.net.ssl.trustStorePassword","changeit");  
            System.out.println(System.getProperty("javax.net.ssl.trustStore"));*/
            // SFParameter: Define a generic SFParameter List.  This is a necessary parameter
            // to invoking calls in SFAPI:      
             /*System.setProperty("javax.net.ssl.keyStore",
             "file:\\\C:\\jdk1.4.1\\jre\\lib\\security\\client.keystore");
             System.setProperty("javax.net.ssl.keyStorePassword","welcome");         */
            /*  System.setProperty("oracle.net.wallet_location",
                          "(SOURCE=(METHOD=file)(METHOD_DATA=(DIRECTORY=\\\C:\Users\dparrish\Oracle\WALLETS)))");  // (2)                     */
            File kstore = new File("C:\\OraHome_1\\jdev\\jdevbin\\jdk\\jre\\lib\\security\\jssecacerts");
            boolean exists = kstore.exists();
            if (!exists) {
                System.out.println("Keystore does not exist");
            else {
                System.out.println("Keystore does exist");
            System.setProperty("javax.net.ssl.trustStore", kstore.getAbsolutePath());
            System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
            //System.setProperty("proxySet", "false");
            //System.setProperty("http.proxyHost", "127.0.0.1");
            //System.setProperty("http.proxyPort", "8080");
            System.out.println(kstore.getAbsolutePath());
            List<SFParameter> lst = new ArrayList<SFParameter>();
            SFParameter param = new SFParameter();
            param.setName("");
            param.setValue("");
            lst.add(param);      
            SFParameter[] sfParam = lst.toArray(new SFParameter[lst.size()]);
            Login login = new Login();
            try {
                login.setCredential(credential);
                System.out.println("1");
                login.setParam(sfParam);
                System.out.println("2");
                LoginResponse loginResponse = new  LoginResponse();
                LoginResult loginResult = new LoginResult();
                try {
                     loginResponse = api.login(login);               
                catch (Exception e ) {
                    System.out.println(e.getMessage());
                System.out.println("3");
                try {               
                     loginResult = loginResponse.getResult();
                catch (Exception e ) {
                    System.out.println(e.getMessage());
                System.out.println("4");
                IsValidSession vs = new IsValidSession();                  
                IsValidSessionResponse isValidSessionResponse = api.isValidSession(vs);
                System.out.println("5");
                if (isValidSessionResponse.isResult()) {
                     System.out.println("Session is valid");
                     System.out.println("Result => " + loginResult.getSessionId());
                     System.out.println(breakLine);              
                    Logout logout = new Logout();
                    LogoutResponse logoutResponse = api.logout(logout);
                    if (logoutResponse.isResult()) {
                         System.out.println("Logout of SFAPI Successful");
                    else {
                        System.out.println("Logout of SFAPI Unsuccessful");
                else {
                     System.out.println("Session is invalid");
                    List<Error> errors = new ArrayList<Error>();
                    for (int i = 0; i < loginResult.getError().length;  i++) {
                        errors.add(loginResult.getError()[i]);
                    for (int i = 0; i < errors.size(); i++) {
                         System.out.println("Error Indice   => " + i);
                         System.out.println("Error Code:    => " + errors.get(i).getErrorCode());
                         System.out.println("Error Message: => " + errors.get(i).getErrorMessage());
                         System.out.println(breakLine);                                                          
                    } // end for loop of SFObject errors
                } // end InvalidSession
            catch (Exception e)
                 System.out.println("Session Credential Exception");
                 System.out.println("Exception => " + e.getMessage());
                 System.out.println(breakLine);                   
        catch (Exception e)
            System.out.println("Parameter List Exception");
            System.out.println("Exception => " + e.getMessage());
            System.out.println(breakLine);
        }   // end runProgram
        // Constructor:
        public SFAPITest()  {
        } // end constructor
        public static void main (String args[]) {
            try
                SFAPITest test = new SFAPITest();        
                test.runProgram();
            catch (Exception e) {
                System.out.println("main exception => " + e.getMessage());
    } // SFAPITest
    Here is the output with trace:
    WARNING: Unable to connect to URL: https://api4.successfactors.com:443/sfapi/v1/soap due to java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
    Session Credential Exception
    Exception => ; nested exception is:
        HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
    +---------------------------------------------------------------------------+
    Process exited with exit code 0.

    The other end is throwing back a programming error.
    That might be because you are sending incorrect data and the other end fails to validate it.
    You might be able to guess based on your C# code.  But, since you are using soap one generic solution is available to you.
    - Get an http proxy interceptor like wireshark.
    - Run it while your C# app runs, collect the http requests from that.
    - Run it while running your java code, collect the http requests from that.
    Compare the two.

  • Method 'DBEngine' of object '_Application' failed

    I am trying to run the latest version of OMWB against an Access 2000 database and am not able to export the information to XML. The subject error message is then followed with another message, 'object variable or With block variable not set'. Any comments or suggestions would be greatly appreciated.
    Harvey

    Hi,
    I believe you are getting the "Method 'DBEngine' of object '_Application' failed" error because there is a problem with your DAO installation. If you manually register the dao360.dll, you should no longer experience this issue when you attempt to use the Exporter tool.
    Execute :
    Regsvr32 "C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll"
    Please refer to the following article for detailed steps:
    http://support.microsoft.com/?scid=kb;en-us;887033&spid=2509&sid=global
    If this does not resolve your issue, please let me know.
    I hope this helps.
    Regards,
    Hilary

  • XPath query works with CLOB but not with object relational

    hi all
    i have the following queries,the XQuery work with all, but XPath queries work with XMLType CLOB and Binary XML, but they do not work with XMLType as Object relational,
    select extract (object_value,'movies/directorfilms/films/film [studios/studio = "Gaumont"]')
    from xorm;
    select extract (object_value,'movies/directorfilms[director/dirname = "L.Cohen"]/films/film[position()=2]/t')
    from xorm;
    they shows this message
    ORA-00932: inconsistent datatypes: expectd SYSTEM.name683_COLL got CHAR
    thanks

    Hi Marco
    fisrt here is my RO
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL=>'http://......../ORMovies.xsd',
    SCHEMADOC=>bfilename('DB','Movies.xsd'),
    LOCAL =>false,
    GENTYPES=>true,
    GENTABLES=>FALSE,
    CSID=>nls_charset_id('AL32UTF8'));
    END;
    create table XORM of xmltype
    xmltype store as object relational
    XMLSCHEMA "http://......../ORMovies.xsd"
    ELEMENT "movies";
    INSERT INTO XORM
    VALUES(XMLType(BFILENAME('DB','ORMovies.xml'),nls_charset_id('AL32UTF8')));
    here the XQuery format that work fine with the OR
    A/D
    select XMLQuery ('for $a in movies/directorfilms/films/film
              where $a/studios/studio = "Gaumont"
              return $a'
         passing object_value
         returning CONTENT)"TitleX"
    from xorm;
    child element query
    select XMLQuery ('for $a in movies/directorfilms/director[dirname = "Feyder"]
              let $b:=$a/../films/film[position()=2]
              return $b/t'
         passing object_value
         returning CONTENT)"TitleX"
    from xorm;
    here is the XPath format which doesn't work
    select extract (object_value,'movies/directorfilms/films/film [studios/studio = "Gaumont"]')
    from xorm;
    select extract (object_value,'movies/directorfilms[director/dirname = "Feyder"]/films/film[position()=2]/t')
    from xorm;
    by the way all queries work fine with the CLOB or Binary XML
    many thanx Marco

  • Need help with creating B*Tree XMLIndex on a structured object-relational xmltype column

    The following is my schema:
    CREATE TABLE TST_AUDIT_TBL
       NOTE                  VARCHAR2(25 CHAR)     null,
       CHANGE_HISTORY        XMLTYPE               not null,
       CHANGE_HISTORY_EXT    XMLTYPE               null
    XMLTYPE COLUMN CHANGE_HISTORY STORE AS OBJECT RELATIONAL XMLSCHEMA "http://www.oracle.com/a.xsd" element "A"
    XMLTYPE COLUMN CHANGE_HISTORY_EXT STORE AS CLOB XMLSCHEMA "http://www.oracle.com/a.xsd" element "AX"
    XML Schema for the above is defined as follows:
    <schema targetNamespace="http://www.oracle.com/a.xsd"
            xmlns:a="http://www.oracle.com/a.xsd"
            xmlns="http://www.w3.org/2001/XMLSchema"  elementFormDefault="qualified">
        <complexType name="AuditExtType">
          <sequence>
            <element name="C" maxOccurs="unbounded" minOccurs="0">
              <complexType>
                <sequence>
                  <element type="string" name="CN"/>
                  <element type="string" name="OV" minOccurs="0" maxOccurs="1"/>
                  <element type="string" name="NV" minOccurs="0" maxOccurs="1"/>
                </sequence>
              </complexType>
            </element>
          </sequence>
        </complexType>
        <complexType name="AuditType">
          <sequence>
            <element type="string" name="M" maxOccurs="1" minOccurs="0"/>
            <element type="string" name="O"/>
            <element name="B" maxOccurs="1" minOccurs="0">
              <complexType>
                <sequence>
                  <element name="BC" minOccurs="1" maxOccurs="unbounded">
                    <complexType>
                      <sequence>
                        <element type="string" name="BN"/>
                        <element name="F" maxOccurs="unbounded" minOccurs="0">
                          <complexType>
                            <sequence>
                              <element type="string" name="FN"/>
                              <element type="string" name="OV" minOccurs="0" maxOccurs="1"/>
                              <element type="string" name="NV" minOccurs="0" maxOccurs="1"/>
                            </sequence>
                          </complexType>
                        </element>
                      </sequence>
                    </complexType> 
                  </element>
                </sequence>
              </complexType>
            </element>
            <element name="T" maxOccurs="1" minOccurs="0">
              <complexType>
                <sequence>
                  <element name="TL" minOccurs="1" maxOccurs="unbounded">
                    <complexType>
                      <sequence>
                        <element type="string" name="TN"/>
                        <element name="C" maxOccurs="unbounded" minOccurs="0">
                          <complexType>
                            <sequence>
                              <element type="string" name="CN"/>
                              <element type="string" name="OV" minOccurs="0" maxOccurs="1"/>
                              <element type="string" name="NV" minOccurs="0" maxOccurs="1"/>
                            </sequence>
                          </complexType>
                        </element>
                      </sequence>
                    </complexType>
                  </element>
                </sequence>
              </complexType>
            </element>
            <element name="I" maxOccurs="1" minOccurs="0">
              <complexType>
                <sequence>
                  <element name="K" maxOccurs="unbounded" minOccurs="0">
                    <complexType>
                      <sequence>
                        <element type="string" name="N"/>
                        <element type="string" name="V"/>
                      </sequence>
                    </complexType>
                  </element>
                </sequence>
              </complexType>
            </element>
          </sequence>
        </complexType>
        <element name="A" type="a:AuditType"/>
        <element name="AX" type="a:AuditExtType"/>
    </schema>
    I want to create a B*Tree XML Index on the above table for the following:
    1. CN
    2. TN
    in the above schema.
    Following the doc, this is what I am issuing:
    SQL> CREATE INDEX audt_audit_idx1 ON TST_AUDIT_TBL(CHANGE_HISTORY) INDEXTYPE IS XDB.XMLINDEX PARAMETERS ('XMLTABLE IXTAB
      2  XMLNAMESPACES(DEFAULT ''http://www.oracle.com/a.xsd''), ''/A'' COLUMNS COLUMN_NAME VARCHAR2(128) PATH ''A/T/TL/C/CN'' ');
    CREATE INDEX audt_audit_idx1 ON TST_AUDIT_TBL(CHANGE_HISTORY) INDEXTYPE IS XDB.XMLINDEX PARAMETERS ('XMLTABLE IXTAB
    ERROR at line 1:
    ORA-29958: fatal error occurred in the execution of ODCIINDEXCREATE routine
    ORA-19276: XPST0005 - XPath step specifies an invalid element/attribute name:
    (A)
    Not sure what is going wrong (and what would be a working xmlindex will look like?)

    Here goes...
    1) Schema registration
    begin
    dbms_xmlschema.registerSchema(
      schemaURL => 'http://www.oracle.com/a.xsd'
    , local     => true
    , genTypes  => true
    , genTables => false
    , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_NONE
    , schemaDoc =>
    '<schema targetNamespace="http://www.oracle.com/a.xsd"
            xmlns:a="http://www.oracle.com/a.xsd"
            xmlns="http://www.w3.org/2001/XMLSchema"  elementFormDefault="qualified">
        <complexType name="AuditExtType">
          <sequence>
            <element name="C" maxOccurs="unbounded" minOccurs="0">
              <complexType>
                <sequence>
                  <element type="string" name="CN"/>
                  <element type="string" name="OV" minOccurs="0" maxOccurs="1"/>
                  <element type="string" name="NV" minOccurs="0" maxOccurs="1"/>
                </sequence>
              </complexType>
            </element>
          </sequence>
        </complexType>
        <complexType name="AuditType">
          <sequence>
            <element type="string" name="M" maxOccurs="1" minOccurs="0"/>
            <element type="string" name="O"/>
            <element name="B" maxOccurs="1" minOccurs="0">
              <complexType>
                <sequence>
                  <element name="BC" minOccurs="1" maxOccurs="unbounded">
                    <complexType>
                      <sequence>
                        <element type="string" name="BN"/>
                        <element name="F" maxOccurs="unbounded" minOccurs="0">
                          <complexType>
                            <sequence>
                              <element type="string" name="FN"/>
                              <element type="string" name="OV" minOccurs="0" maxOccurs="1"/>
                              <element type="string" name="NV" minOccurs="0" maxOccurs="1"/>
                            </sequence>
                          </complexType>
                        </element>
                      </sequence>
                    </complexType>
                  </element>
                </sequence>
              </complexType>
            </element>
            <element name="T" maxOccurs="1" minOccurs="0">
              <complexType>
                <sequence>
                  <element name="TL" minOccurs="1" maxOccurs="unbounded">
                    <complexType>
                      <sequence>
                        <element type="string" name="TN"/>
                        <element name="C" maxOccurs="unbounded" minOccurs="0">
                          <complexType>
                            <sequence>
                              <element type="string" name="CN"/>
                              <element type="string" name="OV" minOccurs="0" maxOccurs="1"/>
                              <element type="string" name="NV" minOccurs="0" maxOccurs="1"/>
                            </sequence>
                          </complexType>
                        </element>
                      </sequence>
                    </complexType>
                  </element>
                </sequence>
              </complexType>
            </element>
            <element name="I" maxOccurs="1" minOccurs="0">
              <complexType>
                <sequence>
                  <element name="K" maxOccurs="unbounded" minOccurs="0">
                    <complexType>
                      <sequence>
                        <element type="string" name="N"/>
                        <element type="string" name="V"/>
                      </sequence>
                    </complexType>
                  </element>
                </sequence>
              </complexType>
            </element>
          </sequence>
        </complexType>
        <element name="A" type="a:AuditType"/>
        <element name="AX" type="a:AuditExtType"/>
    </schema>'
    end;
    2) Table creation
    CREATE TABLE TST_AUDIT_TBL
       NOTE                  VARCHAR2(25 CHAR)     null,
       CHANGE_HISTORY        XMLTYPE               not null,
       CHANGE_HISTORY_EXT    XMLTYPE               null
    XMLTYPE COLUMN CHANGE_HISTORY STORE AS OBJECT RELATIONAL XMLSCHEMA "http://www.oracle.com/a.xsd" element "A"
    XMLTYPE COLUMN CHANGE_HISTORY_EXT STORE AS CLOB XMLSCHEMA "http://www.oracle.com/a.xsd" element "AX"
    3) Retrieving the nested table and column related to the target element :
    SQL> select dbms_xmlstorage_manage.xpath2TabColMapping(
      2           owner_name => 'DEV'
      3         , table_name => 'TST_AUDIT_TBL'
      4         , column_name => 'CHANGE_HISTORY'
      5         , xpath => '/A/T/TL/C/CN'
      6         , namespaces =>'default ''http://www.oracle.com/a.xsd'''
      7         )
      8  from dual;
    DBMS_XMLSTORAGE_MANAGE.XPATH2T
    <Result>
      <Mapping TableName="SYS_NTr0U7dPWyRu6OVvDN2f5HEg==" ColumnName="CN"/>
    </Result>
    4) Creating the index :
    SQL> create index CHANGE_HISTORY_IX1 on "SYS_NTr0U7dPWyRu6OVvDN2f5HEg==" ("CN");
    Index created
    If you're going to create multiple indexes like this, you could really benefit from renaming all the nested tables to meaningful names. That can be done via DBMS_XMLSTORAGE_MANAGE as well.

Maybe you are looking for