Synchronization failure on XMLType column
Hi!,
We're using Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production on Solaris
After creating a table with one schema-based XMLType column, we created a context index on it with the ctxsys.path_section_group as its sole parameter. We populated the table continuously and at 30 minute intervals, though DBMS_JOB, synchronized the text index with CTX_DDL.SYNC_INDEX.
Indexing worked normally in the beginning up to about 11000 records in the base table. After which time, further synchronization failed repeatedly with trace files indicating an error with drsxsopen. Manually sync'ing the index from SQL scratchpad produced the same error. A typical trace file is shown at the bottom.
We also varied the memory parameter to SYNC_INDEX from 2 to 10 to 32 to 512 megabytes with the same results. Index optimization apparently works without error. Furthermore, the sum of pending records and indexed records are equal to the total number of records in the base table. No record has a NULL in the XMLType field.
The XMLType column is stored object-relationally although no schema validation is performed on insertion through triggers. We are running a validation procedure over the entire table but this will take at least a day to complete.
The question is: is this behaviour related to XML validation or are there other issues or bugs that come into play with respect to context index synchronization?
Thanks
/oracle/admin/LLDBCL/bdump/lldbcl_j000_10374.trc
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /oracle/product/10.1.0
System name: SunOS
Node name: db1
Release: 5.9
Version: Generic_118558-25
Machine: sun4u
Instance name: LLDBCL
Redo thread mounted by this instance: 1
Oracle process number: 31
Unix process pid: 10374, image: oracle@db1 (J000)
*** ACTION NAME:() 2006-08-24 19:40:25.427
*** MODULE NAME:() 2006-08-24 19:40:25.427
*** SERVICE NAME:(SYS$USERS) 2006-08-24 19:40:25.427
*** SESSION ID:(123.19014) 2006-08-24 19:40:25.427
*** 2006-08-24 19:40:25.427
ORA-12012: error on auto execute of job 74
ORA-20000: Oracle Text error:
DRG-50857: oracle error in drsxsopen
ORA-22806: not an object or REF
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.CTX_DDL", line 539
ORA-06512: at line 1
-------------------------------------------------------------------------------------------------------------------------------
I did not find the exact cause of the failure, but after creating a new table and creating a BEFORE INSERT trigger with schema validation on the XML column, the problem did not reappear.
The following should be helpful in finding which row(s) cause problems:
ctx_output.start_log ('index_sync.log', false);
ctx_output.add_event (CTX_OUTPUT.EVENT_INDEX_PRINT_ROWID);
ctx_ddl.sync_index (idx, mem);
Similar Messages
-
Help on how to query 11g table with XMLType column
To all,
We have this table:
DESC MESSAGE
Name Null Type
MESSAGE_ID NOT NULL NUMBER(38)
REQUEST_UU_ID NOT NULL VARCHAR2(50)
MESSAGE_TYPE_CD NOT NULL CHAR(3 CHAR)
EMPLOYEE_NUM NOT NULL VARCHAR2(8)
SEQUENCE_NUM VARCHAR2(20)
REVERSAL_SEQUENCE_NUM VARCHAR2(20)
TRANSACTION_TS TIMESTAMP(6)
MESSAGE_CONTENT_TXT NOT NULL XMLTYPE()
CREATE_BY_NM NOT NULL VARCHAR2(50 CHAR)
CREATE_BY_TS NOT NULL TIMESTAMP(6)
LAST_UPDATE_BY_NM NOT NULL VARCHAR2(50 CHAR)
LAST_UPDATE_BY_TS NOT NULL TIMESTAMP(6)
Given we have multiple columns and one is XMLType how do I query to find rows in the db that match this XPath
Here is a fragment of XML that is held in MESSAGE_CONTENT_TXT XMLType column:
<?xml version="1.0" encoding="UTF-8"?>
<cfg-env:Envelope xmlns="http://www.co.com/schemas/CFX/" xmlns:cfg-env="http://www.co.com/schemas/cfg-env/" xmlns:cfg-hdr="http://www.co.com/schemas/cfg-hdr/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.co.com/schemas/cfg-env/" >
<cfg-env:Header>
<cfg-hdr:MessageHeader xmlns:cfg-hdr="http://www.co.com/schemas/cfg-hdr/" xmlns:cfg-env="http://www.co.com/schemas/cfg-env/" xmlns="http://www.co.com/schemas/CFX/">
<cfg-hdr:Service>
<cfg-hdr:ServiceName>process</cfg-hdr:ServiceName>
<cfg-hdr:MessageType>Request</cfg-hdr:MessageType>
<cfg-hdr:ServiceVersion>1</cfg-hdr:ServiceVersion>
</cfg-hdr:Service>
<cfg-hdr:From>
<cfg-hdr:PartyId>13-175-8724</cfg-hdr:PartyId>
<cfg-hdr:CostCenter>2009065</cfg-hdr:CostCenter>
<cfg-hdr:System>
<cfg-hdr:Application>[email protected]</cfg-hdr:Application>
<cfg-hdr:Version>1.0</cfg-hdr:Version>
<cfg-hdr:Channel>TLR</cfg-hdr:Channel>
</cfg-hdr:System>
<cfg-hdr:OrigReplyToQMgr>QMBKRD01</cfg-hdr:OrigReplyToQMgr>
<cfg-hdr:OrigReplyToQ>Q1</cfg-hdr:OrigReplyToQ>
</cfg-hdr:From>
<cfg-hdr:UserSession>
<cfg-hdr:SignonRole>User</cfg-hdr:SignonRole>
<cfg-hdr:LogonId>R099999</cfg-hdr:LogonId>
I'm trying to find rows in the database that are /Envelope/Header/MessageHeader/UserSession/LogonId/R099999.
Thanks for the assistance. I'm new to XML DB. I appreciate the help.
EricHi Eric,
You can use XMLExists, like this :
select *
from message t
where xmlexists(
'declare namespace env = "http://www.co.com/schemas/cfg-env/"; (: :)
declare namespace hdr = "http://www.co.com/schemas/cfg-hdr/"; (: :)
/env:Envelope/env:Header/hdr:MessageHeader/hdr:UserSession[hdr:LogonId=$id]'
passing t.message_content_txt
, 'R099999' as "id"
); -
Issues with using XMLType indexes against a table with XMLType column
I am attempting to use an XMLIndex with a Structured Component and not having too much luck. Not much data in metalink nor is the documentation very helpful:
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb_indexing.htm#BCGHGIGC
The table DDL is as follows:
CREATE TABLE ECI_SCHEMA.REV_ITEM_EARN_DTL_VIRTUAL(
REV_ITEM_EARN_DTL_ID_NBR NUMBER(16,0) NOT NULL,
UNIQ_MSG_ID_NBR VARCHAR2(50) NOT NULL,
REV_ITEM_BILL_DTL_ID_NBR NUMBER(16,0),
PLAN_RACN_NBR NUMBER(10,0) NOT NULL,
INV_DTL_IMG SYS.XMLType NOT NULL,
NON_INV_DTL_IMG BLOB NOT NULL,
PART_KEY_CD GENERATED ALWAYS AS (MOD(PLAN_RACN_NBR,5)) VIRTUAL,
LAST_UPDT_TMSTP TIMESTAMP(6) NOT NULL,
INV_ID_NBR NUMBER(16,0),
ITEM_STATUS_CD VARCHAR2(1) DEFAULT 'A' NOT NULL
LOB (NON_INV_DTL_IMG) STORE AS NON_IDI_LOB (CHUNK 8192 PCTVERSION 10 CACHE)
TABLESPACE ECI_DATA
PARTITION BY RANGE (PART_KEY_CD)
PARTITION RIED_DAY0_PART
VALUES LESS THAN (1)
TABLESPACE ECI_DATA
PARTITION RIED_DAY1_PART
VALUES LESS THAN (2)
TABLESPACE ECI_DATA
PARTITION RIED_DAY2_PART
VALUES LESS THAN (3)
TABLESPACE ECI_DATA
PARTITION RIED_DAY3_PART
VALUES LESS THAN (4)
TABLESPACE ECI_DATA
PARTITION RIED_MAXVAL_PART
VALUES LESS THAN (MAXVALUE)
TABLESPACE ECI_DATA
XMLTYPE COLUMN "INV_DTL_IMG" STORE AS OBJECT RELATIONAL
XMLSCHEMA "someXdbDocument.xsd"
ELEMENT "revenueInvoice"
According to the documentation, I should be able to create a structured XMLIndex on the XMLType column with the following syntax:
SQL> create index eci_schema.rev_item_earn_dtl_virt_xmlix on eci_schema.rev_item_earn_dtl_virtual
2 (INV_DTL_IMG)
3 INDEXTYPE IS XDB.XMLIndex
4 parameters ('PATH TABLE RIED_PATH_TABLE')
5 local;
When I do this, I get the following error:
create index eci_schema.rev_item_earn_dtl_virt_xmlix on eci_schema.rev_item_earn_dtl_virtual
ERROR at line 1:
ORA-29958: fatal error occurred in the execution of ODCIINDEXCREATE routine
ORA-30959: The indexed column is not stored in CLOB.
What am I doing wrong? Based on the Oracle documentation, I was under the impression that 11.2 XMLIndex would work with Object Relational storage. Is this not the case?CREATE INDEX ECI_SCHEMA.REV_ITEM_EARN_DTL_IX7
ON ECI_SCHEMA.REV_ITEM_EARN_DTL
extractValue(inv_dtl_img, '/revenueInvoice/service/transportation/mstrTrkngNbr')
TABLESPACE ECI_REV_ITEM_EARN_DTL_IX7_ITS
LOGGING
PARALLEL(DEGREE 8 INSTANCES 1)
LOCAL
/Elements that occur at most once in each document can be indexed using extractValue(). Despite the fact that the index appears to be a functional index, when we create the index we automatically re-write the create index into a normal btree index on the column that contains the value for the element identified by the xpath.
Eg in the case of a functional index based on extractValue, defined on XMLType using Object relational storage, with an xpath that identifies a node that occurs at most once in each document is not a functional index, it's re-written into a plain old vanilla btree index. You can actually check this by looking in the system tables
Eg
SQL> connect system/oracle
Connected.
SQL> select table_name, index_name from all_indexes where owner = 'OE' and table_name = 'PURCHASEORDER';
TABLE_NAME INDEX_NAME
PURCHASEORDER LINEITEM_TABLE_MEMBERS
PURCHASEORDER ACTION_TABLE_MEMBERS
PURCHASEORDER SYS_C0011037
SQL> alter session set current_schema = OE
2 /
Session altered.
SQL> create unique index PO_REF_INDEX on PURCHASEORDER (extractValue(object_value,'/PurchaseOrder/Reference'));
Index created.
SQL> set lines 250
SQL> select index_name, index_type from all_indexes where owner = 'OE' and table_name = 'PURCHASEORDER';
INDEX_NAME INDEX_TYPE
PO_REF_INDEX NORMAL
LINEITEM_TABLE_MEMBERS NORMAL
ACTION_TABLE_MEMBERS NORMAL
SYS_C0011037 NORMAL
SQL> select * from dba_ind_expressions where table_name = 'PURCHASEORDER' and index_owner = 'OE'
2 /
no rows selectedFrom the above we can see that the index created on extractValue has been re-written in a plain old vanilla BTREE index, and there is no definition for it in dba_ind_expressions So assuming you were able to create the index and insert the data you should find that your index is not a functional index.
] -
How to rename element (node) names in an XMLType column?
I have a source table with a xml data stored in an XMLType column.
The xml contains elements/nodes identified by numbers. I need to replace the numbers with the appropriate names.
The plsql below does this, but has two issues:
i. It selects the data into a clob and does a text replace on the elements in a loop. This works, but is super slow for 3500+ xml rows (about 500 node pairs per row).
ii. Once the data has had the element numbers replaced with the names, it inserts the new xml (clob wrapped in xmltype function) into the table with the XMLType attribute.
The problem with the latter action is that it is failing due to nls client vs server settings, or so it appears from what I could dig up. The actual error message:
ORA-19202: Error occurred in XML processing
LPX-00242: invalid use of ampersand ('&') character (use &)
Error at line 3
There are come entities in the original xml like "" (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;) or this: ° (& #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ł -
How can i change a xmltype column's xml schema?
i create a table that have a xmltype column.this column is schema-based.
my problem is ,
now i want to this column's schema will be redefined to a global schema?
[b]how can i change the column's schema which already have a schema?When a schema is registered a lot of additonal annotations are added to the XML schema by the schema registration process - Look at the version of the XML schema under /sys/schemas/... in the XML DB repository. This information is unqiue to that version of the XML schema and is used internally to manage instance level metadata.
When instance documents are stored in the DB a set of metadata is generated for each document so that we can make sure that we can maintain DOM Fidelity. This metadata is tied directly to the XML schema the document is associated and is only valid in the context of that XML Schema.
So when the schema is registered locally and instances are stored the generated metadata is only valid in the context of the local schema. If the same schema is now registered globally new values will be generated for the annotations applied to the global version of the XML schema. Consequently the metadata associated with a document belonging to the local version of the XML schema has no meaning when viewed in the context of the global version of the XML schema.
The net effect of this is that you will need to copy the data in order to get documents where the metadata for each document is based on the global version of the XML SChema. -
XMLType column based on XML Schema: several questions
Hi,
I've a table on an oracle db version 10.1.0.4 where I stage the xml files containing orders created on a third party's system using BizTalk.
Although the storage I opted for is based on an XML Schema, defined by this third-party, I am facing big perfomance issues with files bigger than a few hundreds of kBs.
For instance, a 32Mb file takes more than 2 hours to be processed.
Now, after reading other threads in this forum and the documentation, my understanding of the problem is that the whole issue is with the correct indexing of the nested tables.
Here is my current XML Schema definition:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xs:include schemaLocation="private/Types.xsd"/>
<xs:element name="PickData">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="ProdRun">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="xs:int"/>
<xs:element name="Date" type="string8"/>
<xs:element name="Final" type="xs:int"/>
<xs:element name="PickWave" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="string10"/>
<xs:element name="ProdLine" type="string2"/>
<xs:element name="TourSeq" type="xs:int"/>
<xs:element name="Tour" type="string20"/>
<xs:element name="Customer" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Seq" type="string20"/>
<xs:element name="Cust" type="string10"/>
<xs:element name="Mod" type="string30"/>
<xs:element name="Tod" type="string30"/>
<xs:element name="InvOrder" maxOccurs="unbounded">
<xs:complexType xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Nr" type="string20"/>
<xs:element name="Item" type="string20"/>
<xs:element name="Qty" type="xs:int"/>
<xs:element name="Priority" type="xs:int"/>
<xs:element name="Reordering" type="xs:int"/>
<xs:element name="DelDate" type="string8"/>
<xs:element name="HlOrder" type="string20"/>
</xs:sequence>
</xs:complexType>
<xs:unique name="InvOrderKey">
<xs:selector xpath="InvOrder"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="CustomerKey">
<xs:selector xpath="Customer"/>
<xs:field xpath="Seq"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="PickWaveKey">
<xs:selector xpath="PickWave"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="ProdRunKey">
<xs:selector xpath="ProdRun"/>
<xs:field xpath="Nr"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Here is the included sub-schema:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="string2">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="2"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string5">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="5"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string6">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="6"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string8">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="8"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string10">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string15">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string20">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="20"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string30">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="30"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string40">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="40"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string50">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="string250">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="250"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
The statement for creating my table is
CREATE TABLE "XML_ORDERS"
("ID" NUMBER(7,0) NOT NULL ENABLE,
"XMLFILE" "SYS"."XMLTYPE" ,
"INSERTED" DATE DEFAULT sysdate,
CONSTRAINT "XML_ORDERS_PK" PRIMARY KEY ("ID") USING INDEX ENABLE
) XMLTYPE COLUMN XMLFILE STORE AS OBJECT RELATIONAL
XMLSCHEMA "private/PickData.xsd" ELEMENT "PickData"
Here is a simple instance document:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<PickData xsi:noNamespaceSchemaLocation="private/PickData.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ProdRun>
<Nr>5</Nr>
<Date>15112005</Date>
<Final>1</Final>
<PickWave>
<Nr>IPW0000017</Nr>
<ProdLine>01</ProdLine>
<TourSeq>1</TourSeq>
<Tour>00000043_078</Tour>
<Customer>
<Seq>5</Seq>
<Cust>100000006</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000457</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000742</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000459</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000742</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>6</Seq>
<Cust>100000013</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000461</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000743</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000463</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000743</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>2</Seq>
<Cust>100000114</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000465</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000744</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000467</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000744</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>3</Seq>
<Cust>100000140</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000469</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000745</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000471</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000745</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>7</Seq>
<Cust>100000143</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000473</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000746</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000475</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000746</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>8</Seq>
<Cust>100000145</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000477</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000747</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000479</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000747</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>9</Seq>
<Cust>100000146</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000481</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000748</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000483</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000748</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>4</Seq>
<Cust>100000147</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000485</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000750</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000487</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000750</HlOrder>
</InvOrder>
</Customer>
<Customer>
<Seq>10</Seq>
<Cust>100000148</Cust>
<Mod>FO</Mod>
<Tod>DDU</Tod>
<InvOrder>
<Nr>IIO0000489</Nr>
<Item>100000036</Item>
<Qty>20</Qty>
<Priority>0</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000751</HlOrder>
</InvOrder>
<InvOrder>
<Nr>IIO0000491</Nr>
<Item>100000045</Item>
<Qty>20</Qty>
<Priority>1</Priority>
<Reordering>0</Reordering>
<DelDate>15112005</DelDate>
<HlOrder>CSO000751</HlOrder>
</InvOrder>
</Customer>
</PickWave>
</ProdRun>
</PickData>
When I registered the XMLSchema, the following types and tables were automatically created and you can see the hierarchy below:
(by the way, I could not find any xdb_utilities.printNestedTables mentioned elsewhere)
XML_ORDERS
|_PickData381_T
|___ProdRun382_T
|_____PickWave388_COLL
|_______PickWave383_T
|_________Customer387_COLL
|___________Customer384_T
|_____________InvOrder386_COLL
These objects are then used in the following nested tables:
TABLE_NAME TABLE_TYPE_NAME PARENT_TABLE_NAME PARENT_TABLE_COLUMN
SYS_NTaK/5zar5S0WitSsgu6OKPQ== PickWave388_COLL PickData389_TAB "XMLDATA"."ProdRun"."PickWave"
SYS_NTf6QvwVm8SFKz+K/YYWq+WQ== Item408_COLL ProdData409_TAB "XMLDATA"."Item"
SYS_NTtu05ilrRQqmuEN4k+07VDA== Customer402_COLL OutboundParty403_TAB "XMLDATA"."Customer"
SYS_NTK6fhWq5uTJ+vKcgBpNm1Fg== InvOrder386_COLL SYS_NTIIzv7bkXQSSS43igtfi5eg== InvOrder
SYS_NTIIzv7bkXQSSS43igtfi5eg== Customer387_COLL SYS_NTaK/5zar5S0WitSsgu6OKPQ== Customer
I enabled sql tracing and I got the following TKPROF output
INSERT INTO IMP_ORDERS (PICK_INVORDERNR, PICK_ITEM, PICK_QTY, PICK_PRIORITY,
PICK_REORDERING, PICK_HLORDER, PICK_DELDATE, PICK_CUST, PICK_MOD, PICK_TOD,
PICK_SEQ, PICK_PICKWAVENR, PICK_PICKWAVEPRODLINE, PICK_PICKWAVETOUR,
PICK_PICKWAVETOURSEQ, PICK_ORDKEY, PICK_RUNKEY) SELECT INVORDERNR, ITEM,
QTY, PRIORITY, REORDERING, HLORDER, DELDATE, CUST, MOD, TOD, SEQ,
PICKWAVENR, PICKWAVEPRODLINE, PICKWAVETOUR, PICKWAVETOURSEQ, ROWNUM AS
PICK_ORDKEY, PRODRUNID FROM (SELECT /*+ cardinality(g 15)*/
EXTRACTVALUE(VALUE(G), '/InvOrder/Nr') AS INVORDERNR, EXTRACTVALUE(VALUE(G),
'/InvOrder/Item') AS ITEM, EXTRACTVALUE(VALUE(G), '/InvOrder/Qty') AS QTY,
EXTRACTVALUE(VALUE(G), '/InvOrder/Priority') AS PRIORITY,
EXTRACTVALUE(VALUE(G), '/InvOrder/Reordering') AS REORDERING,
EXTRACTVALUE(VALUE(G), '/InvOrder/HlOrder') AS HLORDER,
TO_DATE(EXTRACTVALUE(VALUE(G), '/InvOrder/DelDate'),'DDMMYYYY') AS DELDATE,
F.CUST, F.MOD, F.TOD, F.SEQ, F.PICKWAVENR, F.PICKWAVEPRODLINE,
F.PICKWAVETOUR, F.PICKWAVETOURSEQ, F.PRODRUNNR, F.PRODRUNDATE,
F.PRODRUNFINAL, F.PRODRUNID FROM (SELECT /*+ cardinality(e 60)*/VALUE(E) AS
CUSTOMERNODE, EXTRACTVALUE(VALUE(E), '/Customer/Cust') AS CUST,
EXTRACTVALUE(VALUE(E), '/Customer/Mod') AS MOD, EXTRACTVALUE(VALUE(E),
'/Customer/Tod') AS TOD, TO_NUMBER(EXTRACTVALUE(VALUE(E), '/Customer/Seq'))
AS SEQ, D.PICKWAVENR, D.PICKWAVEPRODLINE, D.PICKWAVETOUR, D.PICKWAVETOURSEQ,
D.PRODRUNNR, D.PRODRUNDATE, D.PRODRUNFINAL, D.PRODRUNID FROM (SELECT /*+
cardinality(c 100)*/VALUE(C) AS PICKWAVENODE, EXTRACTVALUE(VALUE(C),
'/PickWave/Nr') AS PICKWAVENR, TO_NUMBER(EXTRACTVALUE(VALUE(C),
'/PickWave/ProdLine')) AS PICKWAVEPRODLINE, EXTRACTVALUE(VALUE(C),
'/PickWave/Tour') AS PICKWAVETOUR, TO_NUMBER(EXTRACTVALUE(VALUE(C),
'/PickWave/TourSeq')) AS PICKWAVETOURSEQ, A.PRODRUNNR, A.PRODRUNDATE,
A.PRODRUNFINAL, A.PRODRUNID FROM (SELECT /*+ cardinality(b 1)*/VALUE(B) AS
PRODRUNNODE, EXTRACTVALUE(VALUE(B), '/ProdRun/Nr') AS PRODRUNNR,
TO_DATE(EXTRACTVALUE(VALUE(B), '/ProdRun/Date'),'DDMMYYYY') AS PRODRUNDATE,
EXTRACTVALUE(VALUE(B), '/ProdRun/Final') AS PRODRUNFINAL, X.ID PRODRUNID
FROM XML_ORDERS X, TABLE(XMLSEQUENCE(EXTRACT(X.XMLFILE,'/PickData/ProdRun'))
) B WHERE X.ID = :B1 ) A, TABLE(XMLSEQUENCE(EXTRACT(A.PRODRUNNODE,
'/ProdRun/PickWave'))) C ) D, TABLE(XMLSEQUENCE(EXTRACT(D.PICKWAVENODE,
'/PickWave/Customer'))) E ) F, TABLE(XMLSEQUENCE(EXTRACT(F.CUSTOMERNODE,
'/Customer/InvOrder'))) G ORDER BY PICKWAVEPRODLINE, PICKWAVETOURSEQ,
PICKWAVENR, SEQ )
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 1 4324.09 9994.65 0 57193 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 2 4324.09 9994.65 0 57193 0 0
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 68 (recursive depth: 1)
Rows Row Source Operation
0 COUNT (cr=0 pr=0 pw=0 time=180 us)
0 VIEW (cr=0 pr=0 pw=0 time=166 us)
0 SORT ORDER BY (cr=0 pr=0 pw=0 time=152 us)
40866 NESTED LOOPS (cr=54973 pr=0 pw=0 time=31065606 us)
1363 NESTED LOOPS (cr=54937 pr=0 pw=0 time=11037183 us)
1 NESTED LOOPS (cr=54889 pr=0 pw=0 time=10145883 us)
1 NESTED LOOPS (cr=54841 pr=0 pw=0 time=9799012 us)
1 TABLE ACCESS BY INDEX ROWID XML_ORDERS (cr=2 pr=0 pw=0 time=222 us)
1 INDEX UNIQUE SCAN XML_ORDERS_PK (cr=1 pr=0 pw=0 time=126 us)(object id 58551)
1 COLLECTION ITERATOR PICKLER FETCH (cr=54839 pr=0 pw=0 time=9798748 us)
1 COLLECTION ITERATOR PICKLER FETCH (cr=48 pr=0 pw=0 time=346818 us)
1363 COLLECTION ITERATOR PICKLER FETCH (cr=48 pr=0 pw=0 time=870830 us)
40866 COLLECTION ITERATOR PICKLER FETCH (cr=36 pr=0 pw=0 time=18739302 us)
Note that I cancelled this operation before it was over so I imagine that these figures refer to the statistics as of the time when the operation was interrupted.
So, here are finally my questions.
In order to create the constraints on the nested tables as shown in other threads, do I need to drop the existing xml_orders table and ancillary object types and recreate them or is there a way to add such constraints using the existing system generated object names?
Secondly, the xml_orders table may contain severale documents, not just one and his current primary key is the column ID. So, in order to uniquely identify the deepest element in the xml document, I need first to select the relevant document by means of the id column.
Would it be better to create the indexes containing this id column together with the nested_table_id and array_index?
Thanks for you help.
Flavio
PS: I wrote a 10 lines xsl transformation that I passed on to Saxon together with the 32Mb file. It took less than 1 minute to produce a flat file that was loaded almost instantly by SQL*Loader. So, what I am looking for is a procedure loading this stuff in less than 2 minutes or possibly less.Does the following help
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:53 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool registerSchema_&4..log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> declare
2 result boolean;
3 begin
4 result := dbms_xdb.createResource('/home/&1/xsd/&4',
5 bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
6 end;
7 /
old 4: result := dbms_xdb.createResource('/home/&1/xsd/&4',
new 4: result := dbms_xdb.createResource('/home/OTNTEST/xsd/GetaxTypes.xsd',
old 5: bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
new 5: bfilename(USER,'GetaxTypes.xsd'),nls_charset_id('AL32UTF8'));
PL/SQL procedure successfully completed.
SQL> commit
2 /
Commit complete.
SQL> alter session set events='31098 trace name context forever'
2 /
Session altered.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 schemaURL => '&3',
5 schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
6 local => TRUE,
7 genTypes => TRUE,
8 genBean => FALSE,
9 genTables => &5
10 );
11 end;
12 /
old 4: schemaURL => '&3',
new 4: schemaURL => 'private/GetaxTypes.xsd',
old 5: schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
new 5: schemaDoc => xdbURIType('/home/OTNTEST/xsd/GetaxTypes.xsd').getClob(),
old 9: genTables => &5
new 9: genTables => TRUE
PL/SQL procedure successfully completed.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:55 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool registerSchema_&4..log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> declare
2 result boolean;
3 begin
4 result := dbms_xdb.createResource('/home/&1/xsd/&4',
5 bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
6 end;
7 /
old 4: result := dbms_xdb.createResource('/home/&1/xsd/&4',
new 4: result := dbms_xdb.createResource('/home/OTNTEST/xsd/PickData.xsd',
old 5: bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
new 5: bfilename(USER,'PickData.xsd'),nls_charset_id('AL32UTF8'));
PL/SQL procedure successfully completed.
SQL> commit
2 /
Commit complete.
SQL> alter session set events='31098 trace name context forever'
2 /
Session altered.
SQL> begin
2 dbms_xmlschema.registerSchema
3 (
4 schemaURL => '&3',
5 schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
6 local => TRUE,
7 genTypes => TRUE,
8 genBean => FALSE,
9 genTables => &5
10 );
11 end;
12 /
old 4: schemaURL => '&3',
new 4: schemaURL => 'private/PickData.xsd',
old 5: schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
new 5: schemaDoc => xdbURIType('/home/OTNTEST/xsd/PickData.xsd').getClob(),
old 9: genTables => &5
new 9: genTables => TRUE
PL/SQL procedure successfully completed.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:58 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool createTable.log
SQL> --
SQL> connect &1/&2
Connected.
SQL> --
SQL> CREATE TABLE "XML_ORDERS"
2 ("ID" NUMBER(7,0) NOT NULL ENABLE,
3 "XMLFILE" "SYS"."XMLTYPE" ,
4 "INSERTED" DATE DEFAULT sysdate,
5 CONSTRAINT "XML_ORDERS_PK" PRIMARY KEY ("ID") USING INDEX ENABLE
6 ) XMLTYPE COLUMN XMLFILE STORE AS OBJECT RELATIONAL
7 XMLSCHEMA "private/PickData.xsd"
8 ELEMENT "PickData"
9 VARRAY XMLFILE."XMLDATA"."ProdRun"."PickWave" STORE AS TABLE PickWave_TAB
10 (
11 ( primary key (nested_table_id, array_index)
12 ) organization index overflow
13 VARRAY "Customer" STORE AS TABLE Customer_TAB
14 (
15 (primary key (nested_table_id, array_index)
16 ) organization index overflow
17 VARRAY "InvOrder" STORE AS TABLE InvOrder_TAB
18 (
19 (primary key (nested_table_id, array_index)
20 ) organization index overflow
21 )
22 )
23 )
24 /
Table created.
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:59 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool insertFile_&3..log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> set long 10000
SQL> --
SQL> insert into XML_ORDERS (ID, XMLFILE) values (&4, xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
2 /
old 1: insert into XML_ORDERS (ID, XMLFILE) values (&4, xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
new 1: insert into XML_ORDERS (ID, XMLFILE) values (10, xmltype(bfilename(USER,'testcase.xml'),nls_charset_id('AL32UT
8')))
1 row created.
Elapsed: 00:00:00.11
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 27 21:44:59 2005
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> spool testcase.log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> set long 10000
SQL> set pages 0 lines 140
SQL> --
SQL> -- Testcase code here
SQL> --
SQL> set autotrace on explain
SQL> --
SQL> create or replace view PROD_RUN_VIEW
2 (
3 PRODRUNNODE,
4 PRODRUNNR,
5 PRODRUNDATE,
6 PRODRUNID,
7 PRODRUNFINAL
8 )
9 as
10 select EXTRACT(XMLFILE,'/PickData/ProdRun'),
11 EXTRACTVALUE(XMLFILE , '/PickData/ProdRun/Nr'),
12 TO_DATE(EXTRACTVALUE(XMLFILE, '/PickData/ProdRun/Date'),'DDMMYYYY'),
13 ID,
14 EXTRACTVALUE(XMLFILE,'/PickData/ProdRun/Final')
15 from XML_ORDERS
16 /
View created.
Elapsed: 00:00:00.09
SQL> create or replace view PICK_WAVE_VIEW
2 (
3 PICKWAVENODE,
4 PICKWAVENR,
5 PICKWAVEPRODLINE,
6 PICKWAVETOUR,
7 PICKWAVETOURSEQ,
8 PRODRUNNR,
9 PRODRUNDATE,
10 PRODRUNID,
11 PRODRUNFINAL
12 )
13 as
14 select value(PW),
15 extractValue(value(PW),'/PickWave/Nr'),
16 TO_NUMBER(EXTRACTVALUE(value(PW),'/PickWave/ProdLine')),
17 extractValue(value(PW),'/PickWave/Tour'),
18 TO_NUMBER(extractValue(value(PW),'/PickWave/TourSeq')),
19 PRODRUNNR,
20 PRODRUNDATE,
21 PRODRUNID,
22 PRODRUNFINAL
23 FROM PROD_RUN_VIEW, table(xmlsequence(extract(PRODRUNNODE,'/ProdRun/PickWave'))) PW
24 /
View created.
Elapsed: 00:00:00.09
SQL> create or replace view CUSTOMER_VIEW
2 (
3 CUSTOMERNODE,
4 CUST,
5 MOD,
6 TOD,
7 SEQ,
8 PICKWAVENR,
9 PICKWAVEPRODLINE,
10 PICKWAVETOUR,
11 PICKWAVETOURSEQ,
12 PRODRUNNR,
13 PRODRUNDATE,
14 PRODRUNFINAL,
15 PRODRUNID
16 )
17 as
18 select value(CUST),
19 EXTRACTVALUE(VALUE(CUST), '/Customer/Cust'),
20 EXTRACTVALUE(VALUE(CUST), '/Customer/Mod'),
21 EXTRACTVALUE(VALUE(CUST), '/Customer/Tod'),
22 TO_NUMBER(EXTRACTVALUE(VALUE(CUST), '/Customer/Seq')),
23 PICKWAVENR,
24 PICKWAVEPRODLINE,
25 PICKWAVETOUR,
26 PICKWAVETOURSEQ,
27 PRODRUNNR,
28 PRODRUNDATE,
29 PRODRUNFINAL,
30 PRODRUNID
31 from PICK_WAVE_VIEW, table(xmlsequence(extract(PICKWAVENODE,'/PickWave/Customer'))) CUST
32 /
View created.
Elapsed: 00:00:00.10
SQL>
SQL> create or replace view INVOICE_ORDER_VIEW
2 (
3 INVORDERNR,
4 ITEM,
5 QTY,
6 PRIORITY,
7 REORDERING,
8 HLORDER,
9 DELDATE,
10 CUST,
11 MOD,
12 TOD,
13 SEQ,
14 PICKWAVENR,
15 PICKWAVEPRODLINE,
16 PICKWAVETOUR,
17 PICKWAVETOURSEQ,
18 PRODRUNNR,
19 PRODRUNDATE,
20 PRODRUNFINAL,
21 PRODRUNID
22 )
23 as
24 SELECT EXTRACTVALUE(VALUE(INV), '/InvOrder/Nr'),
25 EXTRACTVALUE(VALUE(INV), '/InvOrder/Item'),
26 EXTRACTVALUE(VALUE(INV), '/InvOrder/Qty'),
27 EXTRACTVALUE(VALUE(INV), '/InvOrder/Priority'),
28 EXTRACTVALUE(VALUE(INV), '/InvOrder/Reordering'),
29 EXTRACTVALUE(VALUE(INV), '/InvOrder/HlOrder'),
30 TO_DATE(EXTRACTVALUE(VALUE(INV), '/InvOrder/DelDate'),'DDMMYYYY'),
31 CUST,
32 MOD,
33 TOD,
34 SEQ,
35 PICKWAVENR,
36 PICKWAVEPRODLINE,
37 PICKWAVETOUR,
38 PICKWAVETOURSEQ,
39 PRODRUNNR,
40 PRODRUNDATE,
41 PRODRUNFINAL,
42 PRODRUNID
43 FROM CUSTOMER_VIEW, table(xmlsequence(extract(CUSTOMERNODE,'Customer/InvOrder'))) INV
44 /
View created.
Elapsed: 00:00:00.13
SQL> select * from INVOICE_ORDER_VIEW
2 /
IIO0000461 100000036 20 1 0 CSO000743 15-NOV-05 100000013
FO DDU 6 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000463 100000045 20 1 0 CSO000743 15-NOV-05 100000013
FO DDU 6 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000473 100000036 20 1 0 CSO000746 15-NOV-05 100000143
FO DDU 7 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000475 100000045 20 1 0 CSO000746 15-NOV-05 100000143
FO DDU 7 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000469 100000036 20 1 0 CSO000745 15-NOV-05 100000140
FO DDU 3 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000471 100000045 20 1 0 CSO000745 15-NOV-05 100000140
FO DDU 3 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000489 100000036 20 0 0 CSO000751 15-NOV-05 100000148
FO DDU 10 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000491 100000045 20 1 0 CSO000751 15-NOV-05 100000148
FO DDU 10 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000481 100000036 20 0 0 CSO000748 15-NOV-05 100000146
FO DDU 9 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000483 100000045 20 1 0 CSO000748 15-NOV-05 100000146
FO DDU 9 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000485 100000036 20 0 0 CSO000750 15-NOV-05 100000147
FO DDU 4 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000487 100000045 20 1 0 CSO000750 15-NOV-05 100000147
FO DDU 4 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000457 100000036 20 1 0 CSO000742 15-NOV-05 100000006
FO DDU 5 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000459 100000045 20 1 0 CSO000742 15-NOV-05 100000006
FO DDU 5 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000477 100000036 20 1 0 CSO000747 15-NOV-05 100000145
FO DDU 8 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000479 100000045 20 1 0 CSO000747 15-NOV-05 100000145
FO DDU 8 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000465 100000036 20 1 0 CSO000744 15-NOV-05 100000114
FO DDU 2 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
IIO0000467 100000045 20 1 0 CSO000744 15-NOV-05 100000114
FO DDU 2 IPW0000017 1 00000043_078
1
5 15-NOV-05 1 10
18 rows selected.
Elapsed: 00:00:00.22
Execution Plan
Plan hash value: 1730223965
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 18 | 10278 | 877 (0)| 00:00:11 |
| 1 | NESTED LOOPS | | 18 | 10278 | 877 (0)| 00:00:11 |
| 2 | NESTED LOOPS | | 18 | 8424 | 841 (0)| 00:00:11 |
| 3 | MERGE JOIN CARTESIAN | | 18 | 4680 | 805 (0)| 00:00:10 |
| 4 | TABLE ACCESS FULL | XML_ORDERS | 1 | 67 | 3 (0)| 00:00:01 |
| 5 | BUFFER SORT | | 18 | 3474 | 802 (0)| 00:00:10 |
| 6 | INDEX FAST FULL SCAN| SYS_IOT_TOP_64187 | 18 | 3474 | 802 (0)| 00:00:10 |
|* 7 | INDEX UNIQUE SCAN | SYS_IOT_TOP_64185 | 1 | 208 | 2 (0)| 00:00:01 |
|* 8 | INDEX RANGE SCAN | SYS_C008783 | 1 | | 0 (0)| 00:00:01 |
|* 9 | INDEX UNIQUE SCAN | SYS_IOT_TOP_64183 | 1 | 103 | 2 (0)| 00:00:01 |
|* 10 | INDEX RANGE SCAN | SYS_C008785 | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
7 - access("NESTED_TABLE_ID"="CUSTOMER_TAB"."SYS_NC0000800009$")
8 - access("NESTED_TABLE_ID"="CUSTOMER_TAB"."SYS_NC0000800009$")
9 - access("NESTED_TABLE_ID"="PICKWAVE_TAB"."SYS_NC0000800009$")
filter("NESTED_TABLE_ID"="XML_ORDERS"."SYS_NC0001000011$")
10 - access("NESTED_TABLE_ID"="PICKWAVE_TAB"."SYS_NC0000800009$")
Note
- dynamic sampling used for this statement
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
C:\oracle\xdb\otn\347125>You were sequencing the ProdRun node, which is a mistake. Only nodes which occur multiple times should be sequenced... -
What is default size of XMLType column?
I have a table with 1 raw type and 1 XMLType column. In the XMLType column I am inserting following XML,
<ocaStatus xmlns="http://xmlbeans.apache.org/ocastatus">
<status>
<statusCode>990</statusCode>
<statusDateclass="sql-date">2010-01-19</statusDate>
<userId>OcaNimsAcf</userId>
<comment>DocumentnotinNIMS</comment>
</status>
<status>
<statusCode>990</statusCode>
<statusDateclass="sql-date">2010-01-19</statusDate>
<userId>OcaNimsAcf</userId>
<comment>DocumentnotinNIMS</comment>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-09-16</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-09-16</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-09-16</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-29</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-29</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-28</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-28</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-27</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-26</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-25</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-20</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-20</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-20</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>306</statusCode>
<statusDateclass="sql-date">2008-04-21</statusDate>
<userId>u0075970</userId>
</status>
<status>
<statusCode>301</statusCode>
<statusDateclass="sql-date">2008-02-05</statusDate>
<userId>DMS_WORKFLOW</userId>
<comment></comment>
</status>
<status>
<statusCode>990</statusCode>
<statusDateclass="sql-date">2010-01-17</statusDate>
<userId>OcaNimsAcf</userId>
<comment>Comparedfornimsacf</comment>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-09-16</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-09-16</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-09-16</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-29</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-29</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-28</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-28</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-27</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-26</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-25</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-22</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-21</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-20</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-20</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>501</statusCode>
<statusDateclass="sql-date">2008-08-20</statusDate>
<userId>oca_scheduled_job</userId>
</status>
<status>
<statusCode>306</statusCode>
<statusDateclass="sql-date">2008-04-21</statusDate>
<userId>u0075970</userId>
</status>
<status>
<statusCode>301</statusCode>
<statusDateclass="sql-date">2008-02-05</statusDate>
<userId>DMS_WORKFLOW</userId>
<comment></comment>
</status>
</ocaStatus>
The xml is very long. For inserting into the table I am using xmlparse() function to get XMLType.
While doing this I am getting ORA-01704: string literal too long error. It says can accommodate at the most 4000 characters.
I guess XMLType is stored as a CLOB by default.So it should allow more than 4000 characters.
How can I store xml with more than 4000 characters.
Thanks.XMLParse is a SQL function, so you can't use a string literal longer than 4000 chars.
Instead, you may declare a PL/SQL VARCHAR2 variable, which can hold up to 32k characters, and then use the XMLType constructor :
DECLARE
xmlstr VARCHAR2(32767) := '<xml string here>';
xmldoc xmltype;
BEGIN
xmldoc := xmltype(xmlstr);
INSERT INTO your_table(xml_data) VALUES(xmldoc);
END;For strings longer than 32k, you'll probably have to load it from a file. -
Ctxsys.context index on registered schema xmltype column
9iR2
Is it possible to create a text index (indextype is ctxsys.context) on a schema registered xmltype column?
I tried it, the index creation works fine.
After the first insert statement the Oracle process seems to hang. (CPU 100%, increasing memory consumption)Yes, I previously entered some data.
Test case:
1. register schema
begin
DBMS_XMLSCHEMA.REGISTERSCHEMA('http://localhost/JobPositionSeeker-1_1.xsd',
getDocument('JobPositionSeeker-1_1.xsd'), TRUE, TRUE, FALSE, FALSE
end;
2. create table
CREATE TABLE application_xml of XMLType
XMLSCHEMA "http://localhost/JobPositionSeeker-1_1.xsd" ELEMENT "JobPositionSeeker"
3. entered some data
4. created the index
create index applicant on application_xml ( SYS_NC_ROWINFO$)
indextype is ctxsys.context
5. select using index
select value(a).getClobVal() from application_xml a
where contains( value(a),'%ai% INPATH(//PersonalData/PersonName/FamilyName)')>0
6. insert another record
-> crash -
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ðunYou 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. -
Permission issues accross schemas to load XMLTYPE column - structured storage
Hi,
We have a table in BIUSER schema this table is object-realtionally stored with XMLs. When we are trying to load receords from ETLUSER schema we are getting the error as
Record 1: Rejected - Error on table "BIUSER"."PWAYWORKFILE_TABLE".
ORA-00604: error occurred at recursive SQL level 1
ORA-01031: insufficient privileges
Heres the oracle installation details
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production"
All the records are moving to the bad file, whereas the same load happens normally in its own schema i.e. BIUSER
Suspecting this as permission issues we have already given the permission to the table sysnonym as given below in the registration script.
We googled and found few things about ACLs that we are not sure of , its that is the issue please let us know if this table can be created and loaded from different schema
Heres the table creation and registration script
set echo on
spool regschema.log
set define on
set timing on
set long 100000 pages 0 lines 256 trimspool on timing on
drop table PWAYWORKFILE_TABLE;
drop sequence PWAYWORKFILE_TABLE_SEQ;
begin
dbms_xmlschema.deleteschema('workfile.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('TotalLoss.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Salvage.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('rate.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('notes.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Image.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Event.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('estimate.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('CoTotals.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('corr.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Admin.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Vins.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('commonType.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'commonType.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'commonType.xsd';
BEGIN
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Admin.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Admin.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'CoTotals.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'CoTotals.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Event.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Event.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Image.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Image.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Salvage.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Salvage.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'TotalLoss.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'TotalLoss.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Vins.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Vins.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
-- DOM Fidelity enabled due to presence of mixed text, substitution group heads, or repeating choice structures in complex type defintion :-
DBMS_XMLSCHEMA_ANNOTATE.enableMaintainDOM(V_XML_SCHEMA,'RefurbMgr',TRUE);
select /*+ NO_XML_QUERY_REWRITE */
XMLQuery(
'declare namespace xdb = "http://xmlns.oracle.com/xdb"; (:
copy $NEWSCH := $SCHEMA modify (
let $MODEL := $NEWSCH/xs:schema/xs:complexType[11]/xs:all
return (
replace value of node $MODEL/xs:element[2]/xs:complexType/@xdb:maintainDOM with "false",
replace value of node $MODEL/xs:element[3]/xs:complexType/@xdb:maintainDOM with "false",
replace value of node $MODEL/xs:element[4]/xs:complexType/@xdb:maintainDOM with "false"
return $NEWSCH'
passing V_XML_SCHEMA as "SCHEMA"
returning content
into V_XML_SCHEMA
from dual;
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'corr.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'corr.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'estimate.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'estimate.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'notes.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'notes.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'rate.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'rate.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'workfile.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'workfile.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
-- Out-of-Line mappings for 1000 Column optimization :-
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'AdminComp','ADMINCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'NotesComp','NOTESCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'SalvageComp','SALVGCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'CorrComp','CORRCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'ImageComp','IMAGECOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'EventInterfaceManagerComp','EVIFCMGRCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'TotalLossComp','TOTALLOSSCOMP_XML');
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
-- Table creation for namespace "http://www.cccis.com/Pathways/Workfile"
set lines 80
CREATE TABLE "PWAYWORKFILE_TABLE"
SequenceID NUMBER,
DL_CLM_FOLDER_ID VARCHAR2(30),
CUST_CLM_REF_ID VARCHAR(25),
ems_file_nm varchar2(256),
EST_IND VARCHAR2(3),
rec_dt date default sysdate,
filesent_datetime date,
CLM_TYP_CD VARCHAR2(2 CHAR),
WORKFILE XMLTYPE
XMLTYPE COLUMN WORKFILE
STORE AS OBJECT RELATIONAL
XMLSCHEMA "workfile.xsd" ELEMENT "PwayWorkfile"
create sequence PWAYWORKFILE_TABLE_SEQ
start with 1
increment by 1
nomaxvalue
create trigger PWAYWORKFILE_TABLE_TRIGGER
before insert on PWAYWORKFILE_TABLE
for each row
begin
select PWAYWORKFILE_TABLE_SEQ.nextval into :new.SequenceID from dual;
end;
desc PWAYWORKFILE_TABLE
/* create synonym */
create or replace public synonym PWAYWORKFILE_TABLE for PWAYWORKFILE_TABLE;
grant select on PWAYWORKFILE_TABLE to BIUSER_RO;
grant select, insert, update,delete on PWAYWORKFILE_TABLE to biuser_full;
exit;
Regards,
ArghyadipHi MarcoGralike,
I have finally acquired a sample schema and xmls to reproduce the errors that i am getting even after acquiring XDBADMIN privilege and registering my schema as GLOBAL.
Here's the problem i am facing, whenever i intend to store the PublisherList (publisher.xsd) out of line while registration i am running into insufficient privilege issues even if i have the schema registered using (LOCAL => FALSE), whereas it runs smooth in BIUSER and if i dont set it out of line it works in ETLUSER as well.
Here are the 2 XSD files
books.xsd --- this is the root element
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
<xs:include schemaLocation="publisher.xsd"/>
<xs:element name="books" type="bookType"/>
<xs:complexType name="bookType" abstract="true">
<xs:sequence>
<xs:element name="author" type="xs:string" minOccurs="0"/>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="genre" type="xs:string" minOccurs="0"/>
<xs:element ref="PublisherList" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
publisher.xsd -- this is a child elelment which in my actual scenario is so big that i must keep it out of line during registration
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
<xs:element name="PublisherList" type="PublisherListType"/>
<xs:complexType name="PublisherListType">
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="0"/>
<xs:element name="Office" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Here's the sample XML
<?xml version="1.0"?>
<books xmlns:xs="http://www.w3.org/2001/XMLSchema">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<PublisherList>
<Name>Penguin</Name>
<Office>London</Office>
</PublisherList>
</books>
Here's how i am registering the Schemas in BIUSER which has XDBADMIN privilege
DROP TABLE BOOKS_TABLE;
begin
dbms_xmlschema.deleteschema('books.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('publisher.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'publisher.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'publisher.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => FALSE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'books.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'books.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'bookType', 'PublisherList','PUBLISHERLIST_XML');
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => FALSE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
CREATE TABLE BOOKS_TABLE
BOOKS XMLTYPE
XMLTYPE COLUMN BOOKS
STORE AS OBJECT RELATIONAL
XMLSCHEMA "books.xsd" ELEMENT "books"
DROP PUBLIC SYNONYM BOOKS_TABLE;
create or replace public synonym BOOKS_TABLE for BOOKS_TABLE;
grant select, insert, update,delete on BOOKS_TABLE to ETLUSER;
Heres the ctl file that i am using
Load_Books.ctl
OPTIONS (ERRORS=100000, SILENT=(HEADER,FEEDBACK),ROWS=500, BINDSIZE=3072000 , READSIZE=3072000)
load data
infile '/apps/dev/PWXML-10/ctl/load_xml.txt'
BADFILE '/apps/dev/PWXML-10/ctl/load_xml.txt.bad'
DISCARDFILE '/apps/dev/PWXML-10/ctl/load_xml.txt.dsc'
append
into table BOOKS_TABLE
filename filler char(120),
BOOKS lobfile(filename) terminated by eof)
'/apps/dev/PWXML-10/ctl/load_xml.txt' would contain the XML file path that i gave
Heres how i am loading the XML through sqlldr in ETLUSER
sqlldr etluser/etluserpassword@MYXMLDBNAME control=Load_Books.ctl log=Load_Books.ctl.log
Here's the error i am getting
Record 1: Rejected - Error on table "BIUSER"."BOOKS_TABLE".
ORA-00604: error occurred at recursive SQL level 1
ORA-01031: insufficient privileges
Hopefully i have given you all the set up required to pin point the evil error.
Please let me know if i have missed something. -
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. -
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. -
Problem reading a xmlType column (return only 999 rows) with XMLTable
Hello,
I'm new in the forum.
Sorry for my english.
I have a problem reading an xmltype column.
My oracle's version is 11.1.0.6.0
I have a table like this:
Create Table TestXml (idProg number, xmldata XmlType)
XMLTYPE COLUMN xmldata
STORE AS BINARY XML;
I have a xml file containing the equivalent of 10000 record (like a csv).
my schema xsd is the following:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="applicazione">
<xs:annotation>
<xs:documentation>Flusso Monitoraggi</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="periodo" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="segmento" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="progressivo" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="stato" type="xs:string"/>
<xs:element name="ts_start" type="xs:string"/>
<xs:element name="ts_stop" type="xs:string"/>
<xs:element name="nota_esecuzione" type="xs:string"/>
<xs:element name="ts_esecuzione" type="xs:string"/>
</xs:sequence>
<xs:attribute name="valore" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="nome" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="nome" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="nome" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
When I try to read my xmltype column with this select :
SELECT ap.desc_applicazione,pe.seq_periodo, pe.desc_elem_temp_ist,
sg.desc_segmento_elab,pg.seq_progressivo,
pg.desc_stato,pg.ts_start,pg.ts_stop,pg.nota_esecuzione,pg.ts_esecuzione,
pg.valore_prog,sg.seq_segmento,idProg
FROM testXML p,
XMLTable('/applicazione' PASSING p.xmlData
COLUMNS
seq_applicazione for ordinality,
desc_applicazione VARCHAR2(50) PATH '@nome',
periodo XMLType PATH 'periodo') ap,
XMLTable('periodo' PASSING ap.periodo
COLUMNS
seq_periodo for ordinality,
desc_elem_temp_ist VARCHAR2(50) PATH '@nome',
segmento XMLType PATH 'segmento') pe,
XMLTable('segmento' PASSING pe.segmento
COLUMNS
seq_segmento for ordinality,
desc_segmento_elab VARCHAR2(50) PATH '@nome',
progressivo XMLTYPE PATH 'progressivo') sg,
XMLTable('progressivo' PASSING sg.progressivo
COLUMNS
seq_progressivo for ordinality,
valore_prog NUMBER PATH '@valore',
desc_stato VARCHAR(10) PATH 'stato',
ts_start VARCHAR2(50) PATH 'ts_start',
ts_stop VARCHAR2(50) PATH 'ts_stop',
nota_esecuzione VARCHAR2(50) PATH 'nota_esecuzione',
ts_esecuzione VARCHAR2(50) PATH 'ts_esecuzione'
) pg
where idProg = 1
I obtained only 999 rows.
I tried with two file xml, one containing 10000 repetition of progressivo, the other containing 10000 repetition of segmento.
Anybody know why? Where is my error?
Thank you in advance for any response.
MaurizioHello,
I'm new in the forum.
Sorry for my english.
I have a problem reading an xmltype column.
My oracle's version is 11.1.0.6.0
I have a table like this:
Create Table TestXml (idProg number, xmldata XmlType)
XMLTYPE COLUMN xmldata
STORE AS BINARY XML;
I have a xml file containing the equivalent of 10000 record (like a csv).
my schema xsd is the following:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="applicazione">
<xs:annotation>
<xs:documentation>Flusso Monitoraggi</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="periodo" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="segmento" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="progressivo" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="stato" type="xs:string"/>
<xs:element name="ts_start" type="xs:string"/>
<xs:element name="ts_stop" type="xs:string"/>
<xs:element name="nota_esecuzione" type="xs:string"/>
<xs:element name="ts_esecuzione" type="xs:string"/>
</xs:sequence>
<xs:attribute name="valore" type="xs:integer" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="nome" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="nome" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="nome" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>
When I try to read my xmltype column with this select :
SELECT ap.desc_applicazione,pe.seq_periodo, pe.desc_elem_temp_ist,
sg.desc_segmento_elab,pg.seq_progressivo,
pg.desc_stato,pg.ts_start,pg.ts_stop,pg.nota_esecuzione,pg.ts_esecuzione,
pg.valore_prog,sg.seq_segmento,idProg
FROM testXML p,
XMLTable('/applicazione' PASSING p.xmlData
COLUMNS
seq_applicazione for ordinality,
desc_applicazione VARCHAR2(50) PATH '@nome',
periodo XMLType PATH 'periodo') ap,
XMLTable('periodo' PASSING ap.periodo
COLUMNS
seq_periodo for ordinality,
desc_elem_temp_ist VARCHAR2(50) PATH '@nome',
segmento XMLType PATH 'segmento') pe,
XMLTable('segmento' PASSING pe.segmento
COLUMNS
seq_segmento for ordinality,
desc_segmento_elab VARCHAR2(50) PATH '@nome',
progressivo XMLTYPE PATH 'progressivo') sg,
XMLTable('progressivo' PASSING sg.progressivo
COLUMNS
seq_progressivo for ordinality,
valore_prog NUMBER PATH '@valore',
desc_stato VARCHAR(10) PATH 'stato',
ts_start VARCHAR2(50) PATH 'ts_start',
ts_stop VARCHAR2(50) PATH 'ts_stop',
nota_esecuzione VARCHAR2(50) PATH 'nota_esecuzione',
ts_esecuzione VARCHAR2(50) PATH 'ts_esecuzione'
) pg
where idProg = 1
I obtained only 999 rows.
I tried with two file xml, one containing 10000 repetition of progressivo, the other containing 10000 repetition of segmento.
Anybody know why? Where is my error?
Thank you in advance for any response.
Maurizio -
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.
Maybe you are looking for
-
Exporting selected contacts from Outlook 2011 for Mac
I've wanted to easily export a set of selected contacts from Outlook in Microsoft Office for Mac 2011. I've been through many threads about synching to Address Book and then exporting, but I've found a host of troubles, including duplicate copies of
-
Show Date Variable of report in drill down of report
Hi I am using BI7.0 query designer and i am trying to build in the output of the date used in a variable as output in a drilldown in the report.This date is a keydate i use for making snapshots with APD's. Example: Keydate variable value: 01.07.2009
-
i run this import command at dos prompt: c:\imp system/system file=c:\x.dmp full=y i got this error : IMP-00017 : following statement failed with oracle error 4068: "BEGIN SYS.DBMS_REPCAT_MIG_PRE_IMPORT; END;" ORA-04068 : existing state packages has
-
My macbook pro displays a folder with a question mark and won't open. What does this mean and how can I fix it?
-
Some Artwork missing in Album and Artist view
So, after updating to iTunes 11 and my library being trashed. I now have a restored library on Windows 7 with all plycounts and ratings in place. So far so good but a lot of my artwork is missing in both Artist and Album view. I took the trouble to t