XMLTYPE column as BLOB, not CLOB?

All the documentation says,
"When you create an XMLType column in a table, you can choose to store the XML data in a CLOB column or object relationally." (Oracle9i SQL Reference Release 2 (9.2), "Datatypes" section.
(We have db version 9.2.0.4 on aix 5.2)
My question:
Can we store XMLTYPE column in a BLOB? What are the implications?
caveat: object relationally based on registered schema is not an option (not at all) because of existing Oracle bug regarding datetime. 10g is in the (not near) future for us.
thanks in advance.

No....

Similar Messages

  • Can I convert existing column BLOB to CLOB?

    Hi ,
    I need conversion of existing column from BLOB to CLOB. Kindly sueggest workaround. Table structure is as
    { desc tab1;
    Name Null? Type
    Name Null? Type
    RECID NOT NULL VARCHAR2(255)
    XMLRECORD BLOB}
    I need to convert it from blob to clob. Kindly provide workaround.
    Regards

    Hi,
    How can i use this function for my scenario
    1. Table name is "test" and XMLRECORD column should be in CLOB without drop table. Kindly update this fuction as per my scenario and also provide all the steps
    CREATE OR REPLACE FUNCTION blob_to_clob (blob_in IN BLOB)
    RETURN CLOB
    AS
    v_clob CLOB;
    v_varchar VARCHAR2(32767);
    v_start PLS_INTEGER := 1;
    v_buffer PLS_INTEGER := 32767;
    BEGIN
    DBMS_LOB.CREATETEMPORARY(v_clob, TRUE);
    FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(blob_in) / v_buffer)
    LOOP
    v_varchar := UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(blob_in, v_buffer, v_start));
    DBMS_LOB.WRITEAPPEND(v_clob, LENGTH(v_varchar), v_varchar);
    v_start := v_start + v_buffer;
    END LOOP;
    RETURN v_clob;
    END blob_to_clob;
    ]

  • How to create index on a xmltype column stored as CLOB

    actually i have two problems.
    i uploaded this schemaA.xsd file into xmldb repository without problems. registration also went ok.
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    schemaURL => 'http://xmlns.example.com/xdb/documentation/schemaA.xsd'
    ,schemaDoc => sys.UriFactory.getUri('/home/dev/schemaA.xsd')
    ,local => TRUE
    ,genBean => false
    ,genTypes => TRUE
    ,genTables => false
    ,enableHierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    END;
    then i run this:
    create table pf_table_a(
         id VARCHAR2(100) primary key,
         xsd VARCHAR2(3000),
    xml_document XMLType
    ) XMLTYPE COLUMN xml_document
    STORE AS CLOB
    XMLSCHEMA "http://xmlns.example.com/xdb/documentation/schemaA.xsd"
    ELEMENT "order";
    and got this error:
    SQL> @d:\usr\dev\perftest\create_tables.sql
    Table created.
    create table pf_table_a(
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    anyway the table was created. so i went on to create indexes.
    SQL> create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@or
    derNo'));
    create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@orderNo
    ERROR at line 1:
    ORA-04063: table "BAUSER1.PF_TABLE_A" has errors
    this of course is wrong. because the command is for creating index of a XMLTYPE table. no a column. but what is the correct command? thanks.
    jack.

    actually i have two problems.
    i uploaded this schemaA.xsd file into xmldb repository without problems. registration also went ok.
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    schemaURL => 'http://xmlns.example.com/xdb/documentation/schemaA.xsd'
    ,schemaDoc => sys.UriFactory.getUri('/home/dev/schemaA.xsd')
    ,local => TRUE
    ,genBean => false
    ,genTypes => TRUE
    ,genTables => false
    ,enableHierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    END;
    then i run this:
    create table pf_table_a(
         id VARCHAR2(100) primary key,
         xsd VARCHAR2(3000),
    xml_document XMLType
    ) XMLTYPE COLUMN xml_document
    STORE AS CLOB
    XMLSCHEMA "http://xmlns.example.com/xdb/documentation/schemaA.xsd"
    ELEMENT "order";
    and got this error:
    SQL> @d:\usr\dev\perftest\create_tables.sql
    Table created.
    create table pf_table_a(
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    anyway the table was created. so i went on to create indexes.
    SQL> create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@or
    derNo'));
    create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@orderNo
    ERROR at line 1:
    ORA-04063: table "BAUSER1.PF_TABLE_A" has errors
    this of course is wrong. because the command is for creating index of a XMLTYPE table. no a column. but what is the correct command? thanks.
    jack.

  • NOT ABLE TO RECLAIM STORAGE USED BY XMLTYPE COLUMN

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

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

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

  • 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

  • Disable Schema validation in XMLTYPE Column

    Hi all!
    I have created the following table with an Schema-based XMLTYPE column:
    CREATE TABLE ADR1 (
    idnr NUMBER,
    FileType XMLTYPE,
    constraint pk_idnr primary key (idnr))
    XMLTYPE COLUMN FileType STORE AS CLOB
    XMLSCHEMA "http://localhost:8080/home/usr/xsd/cc.xsd"
    ELEMENT "File";
    Now i want to disable the schema - validation for the XMLTYPE Column. I have done this before for an XMLTYPE Table. But in this case of an XMLTYPE Column i cant find the Constraint, that belongs to the Column.
    Thanks for your help!
    Axel

    Hi all!
    I have created the following table with an Schema-based XMLTYPE column:
    CREATE TABLE ADR1 (
    idnr NUMBER,
    FileType XMLTYPE,
    constraint pk_idnr primary key (idnr))
    XMLTYPE COLUMN FileType STORE AS CLOB
    XMLSCHEMA "http://localhost:8080/home/usr/xsd/cc.xsd"
    ELEMENT "File";
    Now i want to disable the schema - validation for the XMLTYPE Column. I have done this before for an XMLTYPE Table. But in this case of an XMLTYPE Column i cant find the Constraint, that belongs to the Column.
    Thanks for your help!
    Axel

  • DirectToXMLTypeMapping "create-tables" not generating XMLTYPE column type

    Can someone tell me how to code an XMLTYPE field such that "create-tables" will generate the XMLTYPE column and such that the IntegrityChecker will not throw an error.
    I am forced to run these alters after "create-tables" is run.
    ALTER TABLE XML_SYS_MSG drop column message;
    ALTER TABLE XML_SYS_MSG add (message XMLType);
    Snippets:
    <persistence...
    <property name="eclipselink.ddl-generation" value="create-tables" />
    </persistence>
    public class XmlMessageCustomizer implements DescriptorCustomizer {
    @Override
    public void customize(final ClassDescriptor descriptor) throws Exception {
    final DirectToXMLTypeMapping mapping = new DirectToXMLTypeMapping();
    descriptor.removeMappingForAttributeName("message");
    // name of the attribute
    mapping.setAttributeName("message");
    // IntegrityChecker requires uppercase for oracle
    // name of the column
    mapping.setFieldName("MESSAGE");
    descriptor.addMapping(mapping);
    @Entity(name = "XmlMessage")
    @Table(name = "XML_MSG")
    @Customizer(XmlMessageCustomizer.class)
    public class XmlMessage {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    private long id;
    // @Column(columnDefinition = "XMLTYPE")
    // private String message;
    // ALTER TABLE XML_SYS_MSG drop column message;
    // ALTER TABLE XML_SYS_MSG add (message XMLType);
    private Document message;
    public XmlMessage() {
    public long getId() {
    return id;
    public void setId(final long id) {
    this.id = id;
    public Document getMessage() {
    return message;
    public void setMessage(final Document message) {
    this.message = message;
    Secondly if I turn on the IntegrityChecker it will fail
    public class EnableIntegrityChecker implements SessionCustomizer {
    @Override
    public void customize(final Session session) throws Exception {
    session.getIntegrityChecker().checkDatabase();
    session.getIntegrityChecker().setShouldCatchExceptions(false);
    }

    Adding:
         mapping.getField().setColumnDefinition("XMLTYPE");to the customizer should solve the problem.
    --Shaun                                                                                                                                                                                                                                                                                       

  • Issues with using XMLType indexes against a table with XMLType column

    I am attempting to use an XMLIndex with a Structured Component and not having too much luck. Not much data in metalink nor is the documentation very helpful:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb_indexing.htm#BCGHGIGC
    The table DDL is as follows:
    CREATE TABLE ECI_SCHEMA.REV_ITEM_EARN_DTL_VIRTUAL(
    REV_ITEM_EARN_DTL_ID_NBR NUMBER(16,0) NOT NULL,
    UNIQ_MSG_ID_NBR VARCHAR2(50) NOT NULL,
    REV_ITEM_BILL_DTL_ID_NBR NUMBER(16,0),
    PLAN_RACN_NBR NUMBER(10,0) NOT NULL,
    INV_DTL_IMG SYS.XMLType NOT NULL,
    NON_INV_DTL_IMG BLOB NOT NULL,
    PART_KEY_CD GENERATED ALWAYS AS (MOD(PLAN_RACN_NBR,5)) VIRTUAL,
    LAST_UPDT_TMSTP TIMESTAMP(6) NOT NULL,
    INV_ID_NBR NUMBER(16,0),
    ITEM_STATUS_CD VARCHAR2(1) DEFAULT 'A' NOT NULL
    LOB (NON_INV_DTL_IMG) STORE AS NON_IDI_LOB (CHUNK 8192 PCTVERSION 10 CACHE)
    TABLESPACE ECI_DATA
    PARTITION BY RANGE (PART_KEY_CD)
    PARTITION RIED_DAY0_PART
    VALUES LESS THAN (1)
    TABLESPACE ECI_DATA
    PARTITION RIED_DAY1_PART
    VALUES LESS THAN (2)
    TABLESPACE ECI_DATA
    PARTITION RIED_DAY2_PART
    VALUES LESS THAN (3)
    TABLESPACE ECI_DATA
    PARTITION RIED_DAY3_PART
    VALUES LESS THAN (4)
    TABLESPACE ECI_DATA
    PARTITION RIED_MAXVAL_PART
    VALUES LESS THAN (MAXVALUE)
    TABLESPACE ECI_DATA
    XMLTYPE COLUMN "INV_DTL_IMG" STORE AS OBJECT RELATIONAL
    XMLSCHEMA "someXdbDocument.xsd"
    ELEMENT "revenueInvoice"
    According to the documentation, I should be able to create a structured XMLIndex on the XMLType column with the following syntax:
    SQL> create index eci_schema.rev_item_earn_dtl_virt_xmlix on eci_schema.rev_item_earn_dtl_virtual
    2 (INV_DTL_IMG)
    3 INDEXTYPE IS XDB.XMLIndex
    4 parameters ('PATH TABLE RIED_PATH_TABLE')
    5 local;
    When I do this, I get the following error:
    create index eci_schema.rev_item_earn_dtl_virt_xmlix on eci_schema.rev_item_earn_dtl_virtual
    ERROR at line 1:
    ORA-29958: fatal error occurred in the execution of ODCIINDEXCREATE routine
    ORA-30959: The indexed column is not stored in CLOB.
    What am I doing wrong? Based on the Oracle documentation, I was under the impression that 11.2 XMLIndex would work with Object Relational storage. Is this not the case?

    CREATE INDEX ECI_SCHEMA.REV_ITEM_EARN_DTL_IX7
           ON ECI_SCHEMA.REV_ITEM_EARN_DTL
                      extractValue(inv_dtl_img, '/revenueInvoice/service/transportation/mstrTrkngNbr')
    TABLESPACE ECI_REV_ITEM_EARN_DTL_IX7_ITS
    LOGGING
    PARALLEL(DEGREE 8 INSTANCES 1)
    LOCAL
    /Elements that occur at most once in each document can be indexed using extractValue(). Despite the fact that the index appears to be a functional index, when we create the index we automatically re-write the create index into a normal btree index on the column that contains the value for the element identified by the xpath.
    Eg in the case of a functional index based on extractValue, defined on XMLType using Object relational storage, with an xpath that identifies a node that occurs at most once in each document is not a functional index, it's re-written into a plain old vanilla btree index. You can actually check this by looking in the system tables
    Eg
    SQL> connect system/oracle
    Connected.
    SQL> select table_name, index_name from all_indexes where owner = 'OE' and table_name = 'PURCHASEORDER';
    TABLE_NAME                     INDEX_NAME
    PURCHASEORDER                  LINEITEM_TABLE_MEMBERS
    PURCHASEORDER                  ACTION_TABLE_MEMBERS
    PURCHASEORDER                  SYS_C0011037
    SQL> alter session set current_schema = OE
      2  /
    Session altered.
    SQL> create unique index PO_REF_INDEX on PURCHASEORDER (extractValue(object_value,'/PurchaseOrder/Reference'));
    Index created.
    SQL> set lines 250
    SQL> select index_name, index_type from all_indexes where owner = 'OE' and table_name = 'PURCHASEORDER';
    INDEX_NAME                     INDEX_TYPE
    PO_REF_INDEX                   NORMAL
    LINEITEM_TABLE_MEMBERS         NORMAL
    ACTION_TABLE_MEMBERS           NORMAL
    SYS_C0011037                   NORMAL
    SQL> select * from dba_ind_expressions where table_name = 'PURCHASEORDER' and index_owner = 'OE'
      2  /
    no rows selectedFrom the above we can see that the index created on extractValue has been re-written in a plain old vanilla BTREE index, and there is no definition for it in dba_ind_expressions So assuming you were able to create the index and insert the data you should find that your index is not a functional index.
    ]

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

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

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

  • ORA-07445 in the alert log when inserting into table with XMLType column

    I'm trying to insert an xml-document into a table with a schema-based XMLType column. When I try to insert a row (using plsql-developer) - oracle is busy for a few seconds and then the connection to oracle is lost.
    Below you''ll find the following to recreate the problem:
    a) contents from the alert log
    b) create script for the table
    c) the before-insert trigger
    d) the xml-schema
    e) code for registering the schema
    f) the test program
    g) platform information
    Alert Log:
    Fri Aug 17 00:44:11 2007
    Errors in file /oracle/app/oracle/product/10.2.0/db_1/admin/dntspilot2/udump/dntspilot2_ora_13807.trc:
    ORA-07445: exception encountered: core dump [SIGSEGV] [Address not mapped to object] [475177] [] [] []
    Create script for the table:
    CREATE TABLE "DNTSB"."SIGNATURETABLE"
    (     "XML_DOCUMENT" "SYS"."XMLTYPE" ,
    "TS" TIMESTAMP (6) WITH TIME ZONE NOT NULL ENABLE
    ) XMLTYPE COLUMN "XML_DOCUMENT" XMLSCHEMA "http://www.sporfori.fo/schemas/www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd" ELEMENT "Object"
    ROWDEPENDENCIES ;
    Before-insert trigger:
    create or replace trigger BIS_SIGNATURETABLE
    before insert on signaturetable
    for each row
    declare
    -- local variables here
    l_sigtab_rec signaturetable%rowtype;
    begin
    if (:new.xml_document is not null) then
    :new.xml_document.schemavalidate();
    end if;
    l_sigtab_rec.xml_document := :new.xml_document;
    end BIS_SIGNATURETABLE2;
    XML-Schema (xmldsig-core-schema.xsd):
    =====================================================================================
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Schema for XML Signatures
    http://www.w3.org/2000/09/xmldsig#
    $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $
    Copyright 2001 The Internet Society and W3C (Massachusetts Institute
    of Technology, Institut National de Recherche en Informatique et en
    Automatique, Keio University). All Rights Reserved.
    http://www.w3.org/Consortium/Legal/
    This document is governed by the W3C Software License [1] as described
    in the FAQ [2].
    [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
    [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
    -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xdb="http://xmlns.oracle.com/xdb"
    targetNamespace="http://www.w3.org/2000/09/xmldsig#" version="0.1" elementFormDefault="qualified">
    <!-- Basic Types Defined for Signatures -->
    <xs:simpleType name="CryptoBinary">
    <xs:restriction base="xs:base64Binary">
    </xs:restriction>
    </xs:simpleType>
    <!-- Start Signature -->
    <xs:element name="Signature" type="ds:SignatureType"/>
    <xs:complexType name="SignatureType">
    <xs:sequence>
    <xs:element ref="ds:SignedInfo"/>
    <xs:element ref="ds:SignatureValue"/>
    <xs:element ref="ds:KeyInfo" minOccurs="0"/>
    <xs:element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="SignatureValue" type="ds:SignatureValueType"/>
    <xs:complexType name="SignatureValueType">
    <xs:simpleContent>
    <xs:extension base="xs:base64Binary">
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:extension>
    </xs:simpleContent>
    </xs:complexType>
    <!-- Start SignedInfo -->
    <xs:element name="SignedInfo" type="ds:SignedInfoType"/>
    <xs:complexType name="SignedInfoType">
    <xs:sequence>
    <xs:element ref="ds:CanonicalizationMethod"/>
    <xs:element ref="ds:SignatureMethod"/>
    <xs:element ref="ds:Reference" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/>
    <xs:complexType name="CanonicalizationMethodType" mixed="true">
    <xs:sequence>
    <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
    <!-- (0,unbounded) elements from (1,1) namespace -->
    </xs:sequence>
    <xs:attribute name="Algorithm" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <xs:element name="SignatureMethod" type="ds:SignatureMethodType"/>
    <xs:complexType name="SignatureMethodType" mixed="true">
    <xs:sequence>
    <xs:element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/>
    <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    <!-- (0,unbounded) elements from (1,1) external namespace -->
    </xs:sequence>
    <xs:attribute name="Algorithm" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <!-- Start Reference -->
    <xs:element name="Reference" type="ds:ReferenceType"/>
    <xs:complexType name="ReferenceType">
    <xs:sequence>
    <xs:element ref="ds:Transforms" minOccurs="0"/>
    <xs:element ref="ds:DigestMethod"/>
    <xs:element ref="ds:DigestValue"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    <xs:attribute name="URI" type="xs:anyURI" use="optional"/>
    <xs:attribute name="Type" type="xs:anyURI" use="optional"/>
    </xs:complexType>
    <xs:element name="Transforms" type="ds:TransformsType"/>
    <xs:complexType name="TransformsType">
    <xs:sequence>
    <xs:element ref="ds:Transform" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="Transform" type="ds:TransformType"/>
    <xs:complexType name="TransformType" mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
    <xs:any namespace="##other" processContents="lax"/>
    <!-- (1,1) elements from (0,unbounded) namespaces -->
    <xs:element name="XPath" type="xs:string"/>
    </xs:choice>
    <xs:attribute name="Algorithm" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <!-- End Reference -->
    <xs:element name="DigestMethod" type="ds:DigestMethodType"/>
    <xs:complexType name="DigestMethodType" mixed="true">
    <xs:sequence>
    <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Algorithm" type="xs:anyURI" use="required"/>
    </xs:complexType>
    <xs:element name="DigestValue" type="ds:DigestValueType"/>
    <xs:simpleType name="DigestValueType">
    <xs:restriction base="xs:base64Binary"/>
    </xs:simpleType>
    <!-- End SignedInfo -->
    <!-- Start KeyInfo -->
    <xs:element name="KeyInfo" type="ds:KeyInfoType"/>
    <xs:complexType name="KeyInfoType" mixed="true">
    <xs:choice maxOccurs="unbounded">
    <xs:element ref="ds:KeyName"/>
    <xs:element ref="ds:KeyValue"/>
    <xs:element ref="ds:RetrievalMethod"/>
    <xs:element ref="ds:X509Data"/>
    <xs:element ref="ds:PGPData"/>
    <xs:element ref="ds:SPKIData"/>
    <xs:element ref="ds:MgmtData"/>
    <xs:any processContents="lax" namespace="##other"/>
    <!-- (1,1) elements from (0,unbounded) namespaces -->
    </xs:choice>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="KeyName" type="xs:string"/>
    <xs:element name="MgmtData" type="xs:string"/>
    <xs:element name="KeyValue" type="ds:KeyValueType"/>
    <xs:complexType name="KeyValueType" mixed="true">
    <xs:choice>
    <xs:element ref="ds:DSAKeyValue"/>
    <xs:element ref="ds:RSAKeyValue"/>
    <xs:any namespace="##other" processContents="lax"/>
    </xs:choice>
    </xs:complexType>
    <xs:element name="RetrievalMethod" type="ds:RetrievalMethodType"/>
    <xs:complexType name="RetrievalMethodType">
    <xs:sequence>
    <xs:element ref="ds:Transforms" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="URI" type="xs:anyURI"/>
    <xs:attribute name="Type" type="xs:anyURI" use="optional"/>
    </xs:complexType>
    <!-- Start X509Data -->
    <xs:element name="X509Data" type="ds:X509DataType"/>
    <xs:complexType name="X509DataType">
    <xs:sequence maxOccurs="unbounded">
    <xs:choice>
    <xs:element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
    <xs:element name="X509SKI" type="xs:base64Binary"/>
    <xs:element name="X509SubjectName" type="xs:string"/>
    <xs:element name="X509Certificate" type="xs:base64Binary"/>
    <xs:element name="X509CRL" type="xs:base64Binary"/>
    <xs:any namespace="##other" processContents="lax"/>
    </xs:choice>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="X509IssuerSerialType">
    <xs:sequence>
    <xs:element name="X509IssuerName" type="xs:string"/>
    <xs:element name="X509SerialNumber" type="xs:integer"/>
    </xs:sequence>
    </xs:complexType>
    <!-- End X509Data -->
    <!-- Begin PGPData -->
    <xs:element name="PGPData" type="ds:PGPDataType"/>
    <xs:complexType name="PGPDataType">
    <xs:choice>
    <xs:sequence>
    <xs:element name="PGPKeyID" type="xs:base64Binary"/>
    <xs:element name="PGPKeyPacket" type="xs:base64Binary" minOccurs="0"/>
    <xs:any namespace="##other" processContents="lax" minOccurs="0"
    maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:sequence>
    <xs:element name="PGPKeyPacket" type="xs:base64Binary"/>
    <xs:any namespace="##other" processContents="lax" minOccurs="0"
    maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:choice>
    </xs:complexType>
    <!-- End PGPData -->
    <!-- Begin SPKIData -->
    <xs:element name="SPKIData" type="ds:SPKIDataType"/>
    <xs:complexType name="SPKIDataType">
    <xs:sequence maxOccurs="unbounded">
    <xs:element name="SPKISexp" type="xs:base64Binary"/>
    <xs:any namespace="##other" processContents="lax" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    <!-- End SPKIData -->
    <!-- End KeyInfo -->
    <!-- Start Object (Manifest, SignatureProperty) -->
    <xs:element name="Object" type="ds:ObjectType"/>
    <xs:complexType name="ObjectType" mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
    <xs:any namespace="##any" processContents="lax"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    <xs:attribute name="MimeType" type="xs:string" use="optional"/> <!-- add a grep facet -->
    <xs:attribute name="Encoding" type="xs:anyURI" use="optional"/>
    </xs:complexType>
    <xs:element name="Manifest" type="ds:ManifestType"/>
    <xs:complexType name="ManifestType">
    <xs:sequence>
    <xs:element ref="ds:Reference" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="SignatureProperties" type="ds:SignaturePropertiesType"/>
    <xs:complexType name="SignaturePropertiesType">
    <xs:sequence>
    <xs:element ref="ds:SignatureProperty" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <xs:element name="SignatureProperty" type="ds:SignaturePropertyType"/>
    <xs:complexType name="SignaturePropertyType" mixed="true">
    <xs:choice maxOccurs="unbounded">
    <xs:any namespace="##other" processContents="lax"/>
    <!-- (1,1) elements from (1,unbounded) namespaces -->
    </xs:choice>
    <xs:attribute name="Target" type="xs:anyURI" use="required"/>
    <xs:attribute name="Id" type="xs:ID" use="optional"/>
    </xs:complexType>
    <!-- End Object (Manifest, SignatureProperty) -->
    <!-- Start Algorithm Parameters -->
    <xs:simpleType name="HMACOutputLengthType">
    <xs:restriction base="xs:integer"/>
    </xs:simpleType>
    <!-- Start KeyValue Element-types -->
    <xs:element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
    <xs:complexType name="DSAKeyValueType">
    <xs:sequence>
    <xs:sequence minOccurs="0">
    <xs:element name="P" type="ds:CryptoBinary"/>
    <xs:element name="Q" type="ds:CryptoBinary"/>
    </xs:sequence>
    <xs:element name="G" type="ds:CryptoBinary" minOccurs="0"/>
    <xs:element name="Y" type="ds:CryptoBinary"/>
    <xs:element name="J" type="ds:CryptoBinary" minOccurs="0"/>
    <xs:sequence minOccurs="0">
    <xs:element name="Seed" type="ds:CryptoBinary"/>
    <xs:element name="PgenCounter" type="ds:CryptoBinary"/>
    </xs:sequence>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
    <xs:complexType name="RSAKeyValueType">
    <xs:sequence>
    <xs:element name="Modulus" type="ds:CryptoBinary"/>
    <xs:element name="Exponent" type="ds:CryptoBinary"/>
    </xs:sequence>
    </xs:complexType>
    <!-- End KeyValue Element-types -->
    <!-- End Signature -->
    </xs:schema>
    ===============================================================================
    Code for registering the xml-schema
    begin
    dbms_xmlschema.deleteSchema('http://xmlns.oracle.com/xdb/schemas/DNTSB/www.sporfori.fo/schemas/www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd',
    dbms_xmlschema.DELETE_CASCADE_FORCE);
    end;
    begin
    DBMS_XMLSCHEMA.REGISTERURI(
    schemaurl => 'http://www.sporfori.fo/schemas/www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd',
    schemadocuri => 'http://www.sporfori.fo/schemas/www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd',
    local => TRUE,
    gentypes => TRUE,
    genbean => FALSE,
    gentables => TRUE,
    force => FALSE,
    owner => 'DNTSB',
    options => 0);
    end;
    Test program
    -- Created on 17-07-2006 by EEJ
    declare
    XML_TEXT3 CLOB := '<Object xmlns="http://www.w3.org/2000/09/xmldsig#">
                                  <SignatureProperties>
                                       <SignatureProperty Target="">
                                            <Timestamp xmlns="http://www.sporfori.fo/schemas/dnts/general/2006/11/14">2007-05-10T12:00:00-05:00</Timestamp>
                                       </SignatureProperty>
                                  </SignatureProperties>
                             </Object>';
    xmldoc xmltype;
    begin
    xmldoc := xmltype(xml_text3);
    insert into signaturetable
    (xml_document, ts)
    values
    (xmldoc, current_timestamp);
    end;
    Platform information
    Operating system:
    -bash-3.00$ uname -a
    SunOS dntsdb 5.10 Generic_125101-09 i86pc i386 i86pc
    SQLPlus:
    SQL*Plus: Release 10.2.0.3.0 - Production on Fri Aug 17 00:15:13 2007
    Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning and Data Mining options
    Kind Regards,
    Eyðun

    You should report this in a service request on http://metalink.oracle.com.
    It is a shame that you put all the effort here to describe your problem, but on the other hand you can now also copy & paste the question to Oracle Support.
    Because you are using 10.2.0.3; I am guessing that you have a valid service contract...

  • Is it possible to remove XMLSchema restriction from an XMLType column?

    I have an XMLType column that is validated via some XMLSchema. Now I want to remove this restriction and make it just a generic XMLType column.
    I tried bunch of alter table commands but I couldn't figure out the magic combination.
    Is this possible?
    Here is the actual problem. Unfortunately, we ended up both local and global schemas using the same URL. We have customers
    out there with both schemas (early customers) or only global schema (new customers). Most of the tables were created before the global schema
    was added. So, they are referencing the local schema. Now we want to evolve our schema, and I am trying to write a sql script to clean-up this mess.
    My plan is:
    if only global schema exists then (these are late customers)
    - do nothing
    else if both global and local schema exist then (these are early customers)
    - If any table or table.column has dependency on local schema (I can find this out from user_dependencies) I am going to mark those
    tables/columns as no schema validated. i.e. remove all references to local schema
    - delete and purge the local schema
    - modify those tables/columns and make them point to the global schema
    end if
    - evolve the schema (only global one is left)
    Is there a better way/plan? Is there a way to modify a column definition and move its reference from local schema to global schema where
    both schemas have the same URL?
    Of course the main constraint is that we do not want to loose customer data. By the way, both local and global schemas are identical in terms of xsd.
    I guess a more generic question would be, is it possible to change XMLSchema/Element settings of an XMLType column from X to Y, X to null, or null to X? (Of course the assumption is Y is a superset of X.)

    Couple of Questions ?
    Which verson of the database...
    Are you using the XML DB repository to provide path based access to the XML Content.
    In general
    1. You cannot break the associated between a table and it's schema..
    So if I understand waht you want to do you will have to do something different..
    Copy the data into a non schema based table (Either XMLType Store AS CLOB or XMLType store as SecureFile Binary XML).
    YOu probably want to invoke the createNonSchemaBasedXML() operator when inserting the XML non schema based table.
    Once all the data is copied, delete and purge the local schema, and all of it's types and tables.
    Create a new table based on the Global Schema.
    Copy the database back into the new table..
    I know two data copies are a PITA, but I can think of no other way of doing this. The Schema Based XML representation contains references that can only be decoded by using the XML Schema that was used to encode the references. This appies to both Schema Based Binary XML and Object Relational Storage.

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

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

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

  • How to insert 4K of XML data into XMLType column?

    I use OCCI and our Oracle version is 9.2.0.1.0. I have successfully been able to insert xml data (any size) into a clob column using "insert into...values(.., empty_clob()) returning c1 into :3"; and then using Statement::GetClob() to acquire a reference to the internal clob and populate it. I cannot seem to be able to do the same when the column type is of XMLType.
    I could not find a single sample code which demonstrates inserting into a table with a XMLType column. Using SetDataBuffer(OCCI_SQLT_STR) with data over 4000 bytes does not work.
    I'd greatly appreciate any feedback.

    Pretty sure this was a bug in the base 9.2 release which was fixed in a patch drop. Try 9.2.0.6 or later.

  • Display BLOB and CLOB on browser

    Hi All.
    I need to display contents of BLOBs and CLOBs on the browser. They can be any docFlavour eg. .jpg, .gif, .pdf, .doc etc
    Is there some standard way of doing this ???
    If any all possible I would rather not use swing class because of its footprint and its slow performance over the net.

    Hi !
    Just in case anyone read this and is willing to comment on it...
    I have one BLOB and one CLOB column in the same record.
    I have been able to stream documents into and out of the BLOB's incl. MS .doc Also I have been able to get the content from BLOB and write it to a target directory.
    However I am having odd problems with CLOB, a simple text file. My servlet attempts to read the CLOB and does create the output file in the target directory, but does not copy the content over. It also returns 0 for clobLength !?! Here is the stub-code :
    ResultSet clobRS = thisStmt.executeQuery (
    "SELECT ATextMsg " +
    "FROM ... " +
    "WHERE ... " );
    clobRS.next();
    CLOB thisCLOB = ((OracleResultSet) clobRS).getCLOB("ATextMsg");
    int chunkSize = thisClob.getChunkSize();
    System.out.println("chunkSize is " + chunkSize); // default us 8132...
    char [] textBuffer = new char[chunkSize];
    String targetFile = targetDir + "retrieved_" + fileName;
    File thisFile = new File(targetFile); // it does create an empty target file...
    // read content as ASCII (text) content...
    FileOutputStream thisFileOutputStream = new FileOutputStream(thisFile);
    OutputStreamWriter thisWriter = new OutputStreamWriter(thisFileOutputStream);
    BufferedWriter thisBufferedWriter = new BufferedWriter(thisWriter);
    // things go wrong here, returns length of 0, why ?!?
    long clobLength = thisClob.length();
    System.out.println("clobLength is " + clobLength);
    // flush to targetFile - but since clobLength=0, nothing gets copied over...
    for (position=1; position<=clobLength; position+=chunkSize)
    int charsRead = thisClob.getChars(position, chunkSize, textBuffer);
    thisBufferedWriter.write(testBuffer);
    Since the clobLength is 0, obviously it will not copy from the database CLOB to the file.
    Manually change the clobLength = 8132, recompile and run, then it copies some junk to the targetFile, certainly not the textual data in the CLOB itself.
    The BLOB is fine...
    Can someone comment on this please and if possible, give me a hint on where I might have gone wrong with a simple text file ???

Maybe you are looking for