Permission issues accross schemas to load XMLTYPE column - structured storage
Hi,
We have a table in BIUSER schema this table is object-realtionally stored with XMLs. When we are trying to load receords from ETLUSER schema we are getting the error as
Record 1: Rejected - Error on table "BIUSER"."PWAYWORKFILE_TABLE".
ORA-00604: error occurred at recursive SQL level 1
ORA-01031: insufficient privileges
Heres the oracle installation details
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production"
All the records are moving to the bad file, whereas the same load happens normally in its own schema i.e. BIUSER
Suspecting this as permission issues we have already given the permission to the table sysnonym as given below in the registration script.
We googled and found few things about ACLs that we are not sure of , its that is the issue please let us know if this table can be created and loaded from different schema
Heres the table creation and registration script
set echo on
spool regschema.log
set define on
set timing on
set long 100000 pages 0 lines 256 trimspool on timing on
drop table PWAYWORKFILE_TABLE;
drop sequence PWAYWORKFILE_TABLE_SEQ;
begin
dbms_xmlschema.deleteschema('workfile.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('TotalLoss.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Salvage.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('rate.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('notes.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Image.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Event.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('estimate.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('CoTotals.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('corr.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Admin.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Vins.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('commonType.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'commonType.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'commonType.xsd';
BEGIN
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Admin.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Admin.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'CoTotals.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'CoTotals.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Event.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Event.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Image.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Image.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Salvage.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Salvage.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'TotalLoss.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'TotalLoss.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Vins.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Vins.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
-- DOM Fidelity enabled due to presence of mixed text, substitution group heads, or repeating choice structures in complex type defintion :-
DBMS_XMLSCHEMA_ANNOTATE.enableMaintainDOM(V_XML_SCHEMA,'RefurbMgr',TRUE);
select /*+ NO_XML_QUERY_REWRITE */
XMLQuery(
'declare namespace xdb = "http://xmlns.oracle.com/xdb"; (:
copy $NEWSCH := $SCHEMA modify (
let $MODEL := $NEWSCH/xs:schema/xs:complexType[11]/xs:all
return (
replace value of node $MODEL/xs:element[2]/xs:complexType/@xdb:maintainDOM with "false",
replace value of node $MODEL/xs:element[3]/xs:complexType/@xdb:maintainDOM with "false",
replace value of node $MODEL/xs:element[4]/xs:complexType/@xdb:maintainDOM with "false"
return $NEWSCH'
passing V_XML_SCHEMA as "SCHEMA"
returning content
into V_XML_SCHEMA
from dual;
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'corr.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'corr.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'estimate.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'estimate.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'notes.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'notes.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'rate.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'rate.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'workfile.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'workfile.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
-- Out-of-Line mappings for 1000 Column optimization :-
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'AdminComp','ADMINCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'NotesComp','NOTESCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'SalvageComp','SALVGCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'CorrComp','CORRCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'ImageComp','IMAGECOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'EventInterfaceManagerComp','EVIFCMGRCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'TotalLossComp','TOTALLOSSCOMP_XML');
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
-- Table creation for namespace "http://www.cccis.com/Pathways/Workfile"
set lines 80
CREATE TABLE "PWAYWORKFILE_TABLE"
SequenceID NUMBER,
DL_CLM_FOLDER_ID VARCHAR2(30),
CUST_CLM_REF_ID VARCHAR(25),
ems_file_nm varchar2(256),
EST_IND VARCHAR2(3),
rec_dt date default sysdate,
filesent_datetime date,
CLM_TYP_CD VARCHAR2(2 CHAR),
WORKFILE XMLTYPE
XMLTYPE COLUMN WORKFILE
STORE AS OBJECT RELATIONAL
XMLSCHEMA "workfile.xsd" ELEMENT "PwayWorkfile"
create sequence PWAYWORKFILE_TABLE_SEQ
start with 1
increment by 1
nomaxvalue
create trigger PWAYWORKFILE_TABLE_TRIGGER
before insert on PWAYWORKFILE_TABLE
for each row
begin
select PWAYWORKFILE_TABLE_SEQ.nextval into :new.SequenceID from dual;
end;
desc PWAYWORKFILE_TABLE
/* create synonym */
create or replace public synonym PWAYWORKFILE_TABLE for PWAYWORKFILE_TABLE;
grant select on PWAYWORKFILE_TABLE to BIUSER_RO;
grant select, insert, update,delete on PWAYWORKFILE_TABLE to biuser_full;
exit;
Regards,
Arghyadip
Hi MarcoGralike,
I have finally acquired a sample schema and xmls to reproduce the errors that i am getting even after acquiring XDBADMIN privilege and registering my schema as GLOBAL.
Here's the problem i am facing, whenever i intend to store the PublisherList (publisher.xsd) out of line while registration i am running into insufficient privilege issues even if i have the schema registered using (LOCAL => FALSE), whereas it runs smooth in BIUSER and if i dont set it out of line it works in ETLUSER as well.
Here are the 2 XSD files
books.xsd --- this is the root element
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
<xs:include schemaLocation="publisher.xsd"/>
<xs:element name="books" type="bookType"/>
<xs:complexType name="bookType" abstract="true">
<xs:sequence>
<xs:element name="author" type="xs:string" minOccurs="0"/>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="genre" type="xs:string" minOccurs="0"/>
<xs:element ref="PublisherList" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
publisher.xsd -- this is a child elelment which in my actual scenario is so big that i must keep it out of line during registration
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
<xs:element name="PublisherList" type="PublisherListType"/>
<xs:complexType name="PublisherListType">
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="0"/>
<xs:element name="Office" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Here's the sample XML
<?xml version="1.0"?>
<books xmlns:xs="http://www.w3.org/2001/XMLSchema">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<PublisherList>
<Name>Penguin</Name>
<Office>London</Office>
</PublisherList>
</books>
Here's how i am registering the Schemas in BIUSER which has XDBADMIN privilege
DROP TABLE BOOKS_TABLE;
begin
dbms_xmlschema.deleteschema('books.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('publisher.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'publisher.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'publisher.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => FALSE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'books.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'books.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'bookType', 'PublisherList','PUBLISHERLIST_XML');
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => FALSE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
CREATE TABLE BOOKS_TABLE
BOOKS XMLTYPE
XMLTYPE COLUMN BOOKS
STORE AS OBJECT RELATIONAL
XMLSCHEMA "books.xsd" ELEMENT "books"
DROP PUBLIC SYNONYM BOOKS_TABLE;
create or replace public synonym BOOKS_TABLE for BOOKS_TABLE;
grant select, insert, update,delete on BOOKS_TABLE to ETLUSER;
Heres the ctl file that i am using
Load_Books.ctl
OPTIONS (ERRORS=100000, SILENT=(HEADER,FEEDBACK),ROWS=500, BINDSIZE=3072000 , READSIZE=3072000)
load data
infile '/apps/dev/PWXML-10/ctl/load_xml.txt'
BADFILE '/apps/dev/PWXML-10/ctl/load_xml.txt.bad'
DISCARDFILE '/apps/dev/PWXML-10/ctl/load_xml.txt.dsc'
append
into table BOOKS_TABLE
filename filler char(120),
BOOKS lobfile(filename) terminated by eof)
'/apps/dev/PWXML-10/ctl/load_xml.txt' would contain the XML file path that i gave
Heres how i am loading the XML through sqlldr in ETLUSER
sqlldr etluser/etluserpassword@MYXMLDBNAME control=Load_Books.ctl log=Load_Books.ctl.log
Here's the error i am getting
Record 1: Rejected - Error on table "BIUSER"."BOOKS_TABLE".
ORA-00604: error occurred at recursive SQL level 1
ORA-01031: insufficient privileges
Hopefully i have given you all the set up required to pin point the evil error.
Please let me know if i have missed something.
Similar Messages
-
Query about XMLTYPE column structured storage in Oracle Xml db
Dear All,
DB Version: Oracle 11g (11.2.0.3.0)
I have an table having one column as XMLTYPE with Structured storage.
CREATE TABLE Orders
Order_id NUMBER NOT NULL,
Order_etc VARCHAR2(100),
Order_desc XMLType NOT NULL
XMLTYPE Order_desc STORE AS OBJECT RELATIONAL XMLSCHEMA "http://localhost/public/xsd/order_desc_xsd.xsd" ELEMENT "OrderState";
I have then registered the XSD with XML Db schema which is required for Structured storage.
Before this table creation I had created a table (db_objects) of XMLTYPE and was able to use the below query to check for what all objects the XMLTYPE table got broken into when I registered its XSD.
SELECT column_name,
data_type
FROM user_tab_cols
WHERE table_name = 'DB_OBJECTS';
And used below query to look for data stored in Object-Relational structure for my table (DB_OBJECTS) created with XMLTYPE definition.
SELECT EXTRACTVALUE(xseq.column_value, '/THISROW/OWNER') AS owner
, EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_NAME') AS object_name
, EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_TYPE') AS object_type
, EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_ID') AS object_id
, EXTRACTVALUE(xseq.column_value, '/THISROW/CREATED') AS created
FROM db_objects do
, TABLE(XMLSEQUENCE(EXTRACT(VALUE(do), '/ROWSET/THISROW'))) xseq
WHERE ROWNUM <= 10;
Now could someone let me know, how to find how the column (Order_desc) of XMLTYPE was broken down into further objects just like I did for the Table with XMLTYPE (as shown above)?
Many Thanks.First given that you are on 11.2, ExtractValue is deprecated and the documentation lists three options to use instead. Here is one option (untested)
SELECT owner, object_name, object_type, object_id, created
FROM db_objects do,
XMLTable('/ROWSET/THISROW'
PASSING do.object_value
COLUMNS
-- Set data types accordingly
owner VARCHAR2(20) PATH 'owner',
object_name VARCHAR2(20) PATH 'object_name',
object_type VARCHAR2(20) PATH 'object_type',
object_id VARCHAR2(20) PATH 'object_id',
created VARCHAR2(20) PATH 'created');
Second, why does column order matter? You are storing in an object relational method. As long as the XML is valid per the schema, the Oracle will be able to store the data and later retrieve it as well. How that data is stored is mostly Oracle internals and should not be touched as it can be changed from version to version. You can use schema annotation to control how Oracle maps and stores the XML, but nothing in there specifies column order that I am aware of.
It seems additional details are missing as to what you need the information for so that would help others answer your question. -
How to use SQL*Loader to load XMLType Column with other columns?
Hi,
I am trying to use sqlldr to load an XML file into a table with an XMLType column. I have found plenty of examples where the entire table is an xmltype, but I would like to load many XML objects into a generic table for processing with one XMLType column and many other columns to identify the load. As a simple example, I have one constant column which I want to set during the upload.
The following example does not work :(. No errors either.
create table xml_upload
(upload_type varchar2(10) not null,
xml_data XMLType)
my control file:
LOAD DATA
INFILE * append
INTO TABLE xml_upload
XMLType(xml_data)
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
upload_type constant MARKET,
xml_data
BEGINDATA
<SALE_ORDER>
<CUST_CODE>TIM</CUST_CODE>
<ORDER_NUM>1234></ORDER_NUM>
</SALE_ORDER>
$ sqlldr my.ctl
SQL*Loader: Release 10.2.0.4.0 - Production on Sun Sep 27 22:51:52 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Commit point reached - logical record count 4
SQL> select * from xml_upload;
no rows selected
SQL>
Any ideas on how I can do this? Am I missing something...
I have also been playing with the lobfile clause of sqlldr, also without any success...
Current database version is 10g R2.
Thanks,
Tim.Hi,
I tried the same example as it is. but, I am getting the following error:
SQL*Loader-350: Syntax error at line 6.
Expecting valid column specification, "," or ")", found "filler".
,file_name char(100) fillerThe table I created is:
create table xml_upload
(upload_type varchar2(10) not null,
xml_data XMLType)The control file I used is:
LOAD DATA
INFILE *
INTO TABLE xml_upload TRUNCATE
upload_type constant 'MARKET'
,file_name char(100) filler
,xml_data LOBFILE (file_name) TERMINATED BY EOF
BEGINDATA
test.xmlThe database I am using is 10gr2 -
Disable Schema validation in XMLTYPE Column
Hi all!
I have created the following table with an Schema-based XMLTYPE column:
CREATE TABLE ADR1 (
idnr NUMBER,
FileType XMLTYPE,
constraint pk_idnr primary key (idnr))
XMLTYPE COLUMN FileType STORE AS CLOB
XMLSCHEMA "http://localhost:8080/home/usr/xsd/cc.xsd"
ELEMENT "File";
Now i want to disable the schema - validation for the XMLTYPE Column. I have done this before for an XMLTYPE Table. But in this case of an XMLTYPE Column i cant find the Constraint, that belongs to the Column.
Thanks for your help!
AxelHi all!
I have created the following table with an Schema-based XMLTYPE column:
CREATE TABLE ADR1 (
idnr NUMBER,
FileType XMLTYPE,
constraint pk_idnr primary key (idnr))
XMLTYPE COLUMN FileType STORE AS CLOB
XMLSCHEMA "http://localhost:8080/home/usr/xsd/cc.xsd"
ELEMENT "File";
Now i want to disable the schema - validation for the XMLTYPE Column. I have done this before for an XMLTYPE Table. But in this case of an XMLTYPE Column i cant find the Constraint, that belongs to the Column.
Thanks for your help!
Axel -
Issues with selecting value from XMLType column
I want to retrieve values from my XMLType column. Can anyone tell me why this works
select XMLCAST
XMLQUERY
'declare default element namespace "urn:hl7-org:v3"; (: :)
declare namespace voc = "urn:hl7-org:v3/voc"; (: :)
$doc/ClinicalDocument/recordTarget/patientRole/patient/name/family'
passing CCD_DOC as "doc"
returning content
as VARCHAR2(4000)
from CCDbut this doesn't?
select
ccdid,
extractvalue(CCD_DOC,'/recordTarget/patientRole/patient/name/given') "given",
extractvalue(CCD_DOC,'/recordTarget/patientRole/patient/name/family') "family",
extractvalue(CCD_DOC,'/recordTarget/patientRole/providerOranization/name') "name",
extractvalue(CCD_DOC, 'title') as Title
from CCDwhere ClinicalDocument is the root element?
I don't get any errors from the second one but the three XML-derived columns are null. The values are not retrieved while the values ARE retrieved using the first method.
Thanks!XMLTable..
select x.*
from CCD,
XMLTable
xmlNamespaces
default 'urn:hl7-org:v3',
'urn:hl7-org:v3/voc' as "voc"
'$doc/ClinicalDocument/recordTarget/patientRole'
passing CCD_DOD as "doc"
columns
given varchar2(128) path 'patient/name/given',
family varchar2(128) path 'patient/name/family',
name varchar2(128) path 'providerOranization/name'
) x -
HELP:Loading XMLtype column from xml file using SQLLOADER
Hi,
My table structure is
crtd_date date,
xml_doc XMLType
I have to insert the data dynamically from sqlloader,is it possible? - if it possible please help with controlfile.
i wrote the controlfile like
LOAD DATA
INTO TABLE drvt_xml replace
XMLType(xmldoc)
FIELDS TERMINATED BY ',' optionally enclosed by '"'
crtd_date SYSDATE,
fname filler char,
xmldoc lobfile(fname) terminated by eof
)Hi,
I am having the same issue wer u able to write the control file and did it work?
If yes pls post ur control file.
Thanks in advance!! -
Generate XPaths from an XMLType column?
Is it possible to load an XML schema into an XMLType column and then generate a list of all the XPaths in that schema?
If so how can this be done:?kcuster,
Here is how you could load it. Maybe someone else has some ideas on generating the XPaths.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
SQL> create table testxsd
2 (schema xmltype);
Table created.
/orasw/admin/DDBA/xmltestcase 167$more vehicle.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.test.ch/a" xmlns:abc="http://www.test.ch/
a" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Vehicle" type="abc:VehicleType"/>
<xs:complexType name="VehicleType">
<xs:sequence>
<xs:element name="ID" type="xs:int"/>
<xs:element name="Name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
SQL> insert into testxsd
2 values (xmltype(getmultixml('vehicle.xsd')));
1 row created.
SQL> SQL> set long 3000
SQL> select * from testxsd;
SCHEMA
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.test.ch/a" xmlns:abc="http://www.test.ch/a" xmlns:xs="http://
www.w3.org/2001/XMLSchema">
<xs:element name="Vehicle" type="abc:VehicleType"/>
<xs:complexType name="VehicleType">
<xs:sequence>
<xs:element name="ID" type="xs:int"/>
<xs:element name="Name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
SCHEMA
</xs:schema>
SQL> -
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. -
Difficulty extracting from XMLTYPE column using XMLTABLE
Hi Folks.
I am currently trying to shred the contents of an XML document that is stored on our schema in a XMLType column. The XMLYTYPE column is pointing to several schemas that are registered within the database.
If I take a subset of the XML from one of the files and create an XMLTYPE column on the fly, I am able to extract data using the XMLTABLE syntax. If I try the same thing on the XMLTYPE column in the table registered to schemas stored in the database I get no joy.
Please see below for an example.
Please note that this is only a small segment of the original XML document which is very large. The XML document has one <RTDRFileHeader> and <ConnectionList> nodes per document but many <Connection> nodes beneath the <ConnectionList>.
My requirement is to RETRIEVE ALL the data contained in the <Connection> elements beneath the <ConnectionList>. How do I achieve this?
CREATE TABLE ag_test2 as
SELECT XMLTYPE(
'<RTDR xmlns:tadig-gen="https://infocentre.gsm.org/TADIG-GEN" xmlns="https://infocentre.gsm.org/TADIG-RTDR">
<RTDRFileHeader>
<Prefix>MRTDR</Prefix>
<Sender>EDSCH</Sender>
<Recipient>NXTMP</Recipient>
<PMN>UKRAS</PMN>
<ReportSeqNo>5</ReportSeqNo>
<TADIGGenSchemaVersion>2.2</TADIGGenSchemaVersion>
<RTDRSchemaVersion>1.1</RTDRSchemaVersion>
<CreationTmstp>2009-09-04T04:04:00.000000+02:00</CreationTmstp>
</RTDRFileHeader>
<ConnectionList xmlns="https://infocentre.gsm.org/TADIG-RTDR">
<Connection xmlns="https://infocentre.gsm.org/TADIG-RTDR">
<VPMN>UKRAS</VPMN>
<HPMN>LIEK9</HPMN>
<FileItemList>
<FileItem>
<FileID>CDUKRASLIEK901274-00005-m</FileID>
<ExchTmstp>2009-08-24T12:07:22.000000+02:00</ExchTmstp>
<FileType>
<InitTAP>
<TAPSeqNo>1274</TAPSeqNo>
<NotifFileInd>true</NotifFileInd>
<ChargeInfo>
<TAPTxCutoffTmstp>2009-08-24T12:52:10.000000+03:00</TAPTxCutoffTmstp>
<TAPAvailTmstp>2009-08-24T11:52:10.000000+02:00</TAPAvailTmstp>
<TAPCurrency>SDR</TAPCurrency>
<TotalNetCharge>0</TotalNetCharge>
<TotalTax>0</TotalTax>
</ChargeInfo>
</InitTAP>
</FileType>
</FileItem>
<FileItem>
<FileID>CDUKRASLIEK901280-00005-m</FileID>
<ExchTmstp>2009-08-30T12:14:39.000000+02:00</ExchTmstp>
<FileType>
<InitTAP>
<TAPSeqNo>1280</TAPSeqNo>
<NotifFileInd>true</NotifFileInd>
<ChargeInfo>
<TAPTxCutoffTmstp>2009-08-30T12:52:34.000000+03:00</TAPTxCutoffTmstp>
<TAPAvailTmstp>2009-08-30T11:52:34.000000+02:00</TAPAvailTmstp>
<TAPCurrency>SDR</TAPCurrency>
<TotalNetCharge>0</TotalNetCharge>
<TotalTax>0</TotalTax>
</ChargeInfo>
</InitTAP>
</FileType>
</FileItem>
</FileItemList>
</Connection>
</ConnectionList>
</RTDR> ') as xml from dual
Question: When I run the following query no rows are returned although the table is populated with XML segment above. Any explanation as to why and how can I resolve this?
SELECT rtd2."VPMN"
,rtd2."Recipient"
,rtd2."ReportSeqNo"
FROM ag_test2 r
,XMLTABLE('/RTDR'
PASSING r.xml
COLUMNS "VPMN" VARCHAR2(5) PATH '/RTDRFileHeader/ConnectionList/Connection/VPMN'
,"Recipient" VARCHAR2(5) PATH '/RTDRFileHeader/Recipient'
,"ReportSeqNo" INTEGER PATH '/RTDRFileHeader/ReportSeqNo'
) rtd2; From my other investigations the following query works OK when the same XML segment is created dynamically by performing an SELECT XMLTYPE ... FROM DUAL compared to the method above. Can anybody provide an explanation?
WITH t as (select XMLTYPE(
'<RTDR>
<RTDRFileHeader>
<Prefix>MRTDR</Prefix>
<Sender>EDSCH</Sender>
<Recipient>NXTMP</Recipient>
<PMN>UKRAS</PMN>
<ReportSeqNo>5</ReportSeqNo>
<TADIGGenSchemaVersion>2.2</TADIGGenSchemaVersion>
<RTDRSchemaVersion>1.1</RTDRSchemaVersion>
<CreationTmstp>2009-09-04T04:04:00.000000+02:00</CreationTmstp>
</RTDRFileHeader>
<ConnectionList>
<Connection>
<VPMN>UKRAS</VPMN>
<HPMN>LIEK9</HPMN>
<FileItemList>
<FileItem>
<FileID>CDUKRASLIEK901274-00005-m</FileID>
<ExchTmstp>2009-08-24T12:07:22.000000+02:00</ExchTmstp>
<FileType>
<InitTAP>
<TAPSeqNo>1274</TAPSeqNo>
<NotifFileInd>true</NotifFileInd>
<ChargeInfo>
<TAPTxCutoffTmstp>2009-08-24T12:52:10.000000+03:00</TAPTxCutoffTmstp>
<TAPAvailTmstp>2009-08-24T11:52:10.000000+02:00</TAPAvailTmstp>
<TAPCurrency>SDR</TAPCurrency>
<TotalNetCharge>0</TotalNetCharge>
<TotalTax>0</TotalTax>
</ChargeInfo>
</InitTAP>
</FileType>
</FileItem>
<FileItem>
<FileID>CDUKRASLIEK901280-00005-m</FileID>
<ExchTmstp>2009-08-30T12:14:39.000000+02:00</ExchTmstp>
<FileType>
<InitTAP>
<TAPSeqNo>1280</TAPSeqNo>
<NotifFileInd>true</NotifFileInd>
<ChargeInfo>
<TAPTxCutoffTmstp>2009-08-30T12:52:34.000000+03:00</TAPTxCutoffTmstp>
<TAPAvailTmstp>2009-08-30T11:52:34.000000+02:00</TAPAvailTmstp>
<TAPCurrency>SDR</TAPCurrency>
<TotalNetCharge>0</TotalNetCharge>
<TotalTax>0</TotalTax>
</ChargeInfo>
</InitTAP>
</FileType>
</FileItem>
</FileItemList>
</Connection>
</ConnectionList>
</RTDR> ') as xml from dual )
SELECT rtd2."VPMN"
,rtd2."HPMN"
FROM t r
,XMLTABLE('/RTDR/ConnectionList'
PASSING r.xml
COLUMNS "VPMN" VARCHAR2(5) PATH '/ConnectionList/Connection/VPMN'
,"HPMN" VARCHAR2(5) PATH '/ConnectionList/Connection/HPMN'
) rtd2;
Any comments, suggestions, pointers gratefully received.
Many thanks
Kind regards
Simon GaddSimon
It appears to work as expected for me in 11.2.0.1.0
C:\xdb\customers\Mapeley>sqlplus /nolog @testcase %CD%
SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 18 14:26:56 2009
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> spool testase.log
SQL> --
SQL> connect / as sysdba
Connected.
SQL> --
SQL> set define on
SQL> set timing on
SQL> --
SQL> define USERNAME = MAPELEY
SQL> --
SQL> def PASSWORD = &USERNAME
SQL> --
SQL> def XMLDIR = &1
SQL> --
SQL> def USER_TABLESPACE = USERS
SQL> --
SQL> def TEMP_TABLESPACE = TEMP
SQL> --
SQL> drop user &USERNAME cascade
2 /
old 1: drop user &USERNAME cascade
new 1: drop user MAPELEY cascade
User dropped.
Elapsed: 00:00:04.57
SQL> grant create any directory, drop any directory, connect, resource, alter se
ssion, create view to &USERNAME identified by &PASSWORD
2 /
old 1: grant create any directory, drop any directory, connect, resource, alte
r session, create view to &USERNAME identified by &PASSWORD
new 1: grant create any directory, drop any directory, connect, resource, alte
r session, create view to MAPELEY identified by MAPELEY
Grant succeeded.
Elapsed: 00:00:00.03
SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespa
ce &TEMP_TABLESPACE
2 /
old 1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tabl
espace &TEMP_TABLESPACE
new 1: alter user MAPELEY default tablespace USERS temporary tablespace TEMP
User altered.
Elapsed: 00:00:00.00
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> create or replace directory XMLDIR as '&XMLDIR'
2 /
old 1: create or replace directory XMLDIR as '&XMLDIR'
new 1: create or replace directory XMLDIR as 'C:\xdb\customers\Mapeley'
Directory created.
Elapsed: 00:00:00.01
SQL> var SCHEMAURL varchar2(256)
SQL> VAR XMLSCHEMA CLOB;
SQL> VAR INSTANCE CLOB;
SQL> VAR DOCPATH VARCHAR2(700)
SQL> --
SQL> set define off
SQL> --
SQL> alter session set events='31098 trace name context forever'
2 /
Session altered.
Elapsed: 00:00:00.01
SQL> declare
2 XMLSCHEMA XMLTYPE := XMLTYPE(bfilename('XMLDIR','tadig_gen_2.2.xsd'),NLS_
CHARSET_ID('AL32UTF8'));
3 begin
4 :SCHEMAURL:= 'tadig-gen-2.2.xsd';
5 xdb_annotate_schema.disableDefaultTables(XMLSCHEMA);
6 dbms_xmlschema.registerSchema
7 (
8 schemaurl => :SCHEMAURL,
9 schemadoc => XMLSCHEMA,
10 local => TRUE,
11 genTypes => TRUE,
12 genBean => FALSE,
13 genTables => TRUE
14 );
15 end;
16 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:01.17
SQL> declare
2 XMLSCHEMA XMLTYPE := XMLTYPE(bfilename('XMLDIR','tadig_rtdr.xsd'),NLS_CHA
RSET_ID('AL32UTF8'));
3 begin
4 :SCHEMAURL:= 'tadig_rtdr.xsd';
5 xdb_annotate_schema.addDefaultTable(XMLSCHEMA,'RTDR','RTDR_TABLE');
6 xdb_annotate_schema.disableDefaultTables(XMLSCHEMA);
7 dbms_xmlschema.registerSchema
8 (
9 schemaurl => :SCHEMAURL,
10 schemadoc => XMLSCHEMA,
11 local => TRUE,
12 genTypes => TRUE,
13 genBean => FALSE,
14 genTables => TRUE
15 );
16 end;
17 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:05.66
SQL> select table_name
2 from USER_XML_TABLES
3 /
TABLE_NAME
RTDR_TABLE
Elapsed: 00:00:00.04
SQL> select count(*)
2 from USER_NESTED_TABLES
3 /
COUNT(*)
17
Elapsed: 00:00:00.43
SQL> desc RTDR_TABLE
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "tadig_rtdr.xsd" Element "RTDR") STORAGE Object-r
elational TYPE "RTDR8050_T"
SQL> --
SQL> insert into RTDR_TABLE values (XMLTYPE(bfilename('XMLDIR','MRTDREDSCHNXTMPU
KRAS00001.xml'),NLS_CHARSET_ID('AL32UTF8')))
2 /
1 row created.
Elapsed: 00:00:16.91
SQL> commit
2 /
Commit complete.
Elapsed: 00:00:00.01
SQL> set autotrace on explain lines 256 long 100000 pages 0
SQL> --
SQL> SELECT rtd3."VPMN"
2 ,rtd2."Recipient"
3 ,rtd2."ReportSeqNo"
4 FROM RTDR_TABLE r
5 ,XMLTABLE
6 (
7 xmlnamespaces
8 (
9 default 'https://infocentre.gsm.org/TADIG-RTDR'
10 ),
11 '/RTDR'
12 PASSING r.object_value
13 COLUMNS
14 "ConnectionXML" XMLTYPE PATH 'ConnectionList/Connection'
15 ,"Recipient" VARCHAR2(5) PATH 'RTDRFileHeader/Recipient'
16 ,"ReportSeqNo" INTEGER PATH 'RTDRFileHeader/ReportSeqNo'
17 ) rtd2
18 ,XMLTABLE
19 (
20 xmlnamespaces
21 (
22 default 'https://infocentre.gsm.org/TADIG-RTDR'
23 ),
24 '/Connection'
25 PASSING rtd2."ConnectionXML"
26 COLUMNS
27 "VPMN" VARCHAR2(6) PATH 'VPMN'
28 ) rtd3
29 /
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
LIEK9 NXTMP 1
ABWK9 NXTMP 1
MCOK9 NXTMP 1
CHEK7 NXTMP 1
DJIK9 NXTMP 1
SGPK9 NXTMP 1
NAMK9 NXTMP 1
SENK9 NXTMP 1
NZLK9 NXTMP 1
CIV55 NXTMP 1
TURTK NXTMP 1
GINCL NXTMP 1
BFA03 NXTMP 1
NER55 NXTMP 1
DOMC9 NXTMP 1
NGA55 NXTMP 1
GRCCO NXTMP 1
GRCSH NXTMP 1
NLDPT NXTMP 1
BELTB NXTMP 1
BELMO NXTMP 1
B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AS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
UKRAS NXTMP 1
641 rows selected.
Elapsed: 00:00:01.15
Execution Plan
Plan hash value: 3612307998
| Id | Operation | Name | Rows | Bytes | Co
st (%CPU)| Time |
| 0 | SELECT STATEMENT | | 641 | 2539K|
9 (12)| 00:00:01 |
|* 1 | HASH JOIN | | 641 | 2539K|
9 (12)| 00:00:01 |
|* 2 | TABLE ACCESS FULL| RTDR_TABLE | 1 | 2045 |
3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| SYS_NTeF0jsoIcQsOueVI+sFGk0g== | 641 | 1259K|
5 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - access("SYS_ALIAS_0"."NESTED_TABLE_ID"="RTDR_TABLE"."SYS_NC0002300024$")
2 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.
w3.org/2001/XMLSchema-insta
nce" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xd
b/dav.xsd"><read-properties
/><read-contents/></privilege>'))=1)
Note
- dynamic sampling used for this statement (level=2)
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64
bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
C:\xdb\customers\Mapeley> -
Difference between an XMLType table and a table with an XMLType column?
Hi all,
Still trying to get my mind around all this XML stuff.
Can someone concisely explain the difference between:
create table this_is_xmltype_tab of xmltype;and
create table this_is_tab_w_xmltpe_col(id number, document xmltype);What are the relative advantages and disadvantages of each approach? How do they really differ?
Thanks,
-MarkThere is another pointer Mark, that I realized when I was thinking about the differences...
If you would look up in the manual regarding "xdb:annotations" you would learn about a method using an XML Schema to generate out of the box your whole design in terms of physical layout and/or design principles. In my mind this should be the preferred solution if you are dealing with very complex XML Schema environments. Taking your XML Schema as your single point design layout, that during the actual implementation automatically generates and builds all your needed database objects and its physical requirements, has great advantages in points of design version management etc., but...
...it will create automatically an XMLType table (based on OR, Binary XML of "hybrid" storage principles, aka the ones that are XML Schema driven) and not AFAIK a XMLtype column structure: so as in "our" case a table with a id column and a xmltype column.
In principle you could relationally relate to this as:
+"I have created an EER diagram and a Physical diagram, I mix the content/info of those two into one diagram." "Then I _+execute+_ it in the database and the end result will be an database user/schema that has all the xxxx amount of physical objects I need, the way I want it to be...".+
...but it will be in the form of an XMLType table structure...
xdb:annotations can be used to create things like:
- enforce database/company naming conventions
- DOM validation enabled or not
- automatic IOT or BTree index creation (for instance in OR XMLType storage)
- sort search order enforced or not
- default tablenames and owners
- extra column or table property settings like for partitioning XML data
- database encoding/mapping used for SQL and binary storage
- avoid automatic creation of Oracle objects (tables/types/etc), for instance, via xdb:defaultTable="" annotations
- etc...
See here for more info: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb05sto.htm#ADXDB4519
and / or for more detailed info:
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb05sto.htm#i1030452
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb05sto.htm#i1030995
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10492/xdb05sto.htm#CHDCEBAG
... -
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... -
Unable to load into XMLTYPE column
HI Gentlemen,
I have considerable difficulties with loading XML content into an XMLTYPE column. Here are the annotated schemas:
SQL> select any_path from resource_view where any_path like '%GKSADMIN/ICD%';
ANY_PATH
/sys/schemas/GKSADMIN/ICD
/sys/schemas/GKSADMIN/ICD/datentypen_V1.40.xsd
/sys/schemas/GKSADMIN/ICD/ehd_header_V1.40.xsd
/sys/schemas/GKSADMIN/ICD/ehd_root_V1.40.xsd
/sys/schemas/GKSADMIN/ICD/icd_body.xsd
/sys/schemas/GKSADMIN/ICD/icd_header.xsd
/sys/schemas/GKSADMIN/ICD/icd_root.xsd
/sys/schemas/GKSADMIN/ICD/keytabs_V1.40.xsd
8 Zeilen ausgewählt.And here is the relational table:
SQL> describe icd
Name Null? Typ
ID CHAR(2)
XML_DOCUMENT SYS.XMLTYPE(XMLSchema "ICD/i
cd_root.xsd" Element "ehd")
STORAGE Object-relational TY
PE "ICD$ICD_ROOT_TYP"Now, when I try to load an instance document (which has proven OK with xmloracle), the following happens:
SQL> @loadxmlfileascolumn_int
Geben Sie einen Wert für source_directory ein: c:\gks\kbv\c\icd\xml
alt 1: create or replace directory SOURCE_DIR as '&source_directory'
neu 1: create or replace directory SOURCE_DIR as 'c:\gks\kbv\c\icd\xml'
Verzeichnis wurde erstellt.
Geben Sie einen Wert für xmltypetable ein: icd
alt 4: INSERT INTO &XMLTypeTable
neu 4: INSERT INTO icd
Geben Sie einen Wert für id ein: 01
Geben Sie einen Wert für instancedocument ein: icdtest.xml
alt 5: VALUES (&id, XMLType(bfilename('SOURCE_DIR', '&InstanceDocument'),
neu 5: VALUES (01, XMLType(bfilename('SOURCE_DIR', 'icdtest.xml'),
declare
FEHLER in Zeile 1:
ORA-01830: Datumsformatstruktur endet vor Umwandlung der gesamten
Eingabezeichenfolge
ORA-06512: in Zeile 4
SQL> spool offSince the schemas are very big, I took only relevant parts of them to show:
<ehd:document_type_cd V="ICD" DN="ICD-Stammdatei" S="1.2.276.0.76.5.100"/>
<ehd:service_tmr V="2010-01-01..2010-12-31"/>
<ehd:origination_dttm V="2009-11-10+01:00"/>Guilty is allegedly origination_dttm with its time zone. However, consider the type resolution below that leads to xs:date. This should be able to accommodate the time zone as well.
<!-- ************************ origination_dttm_typ ********************************* -->
<xs:element name="origination_dttm" type="origination_dttm_typ">
<xs:annotation>
<xs:documentation>Erstellungsdatum</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="origination_dttm_typ">
<xs:complexContent>
<xs:extension base="v_date_typ"/>
</xs:complexContent>
</xs:complexType>
v_date_typ: enthält nur den V-Attribut für einfache Datums-Angaben
<!-- ************************ v_date_typ ********************************** -->
<xs:complexType name="v_date_typ">
<xs:attribute name="V" type="xs:date" use="required"/>
</xs:complexType>When I delete the time zone portion in the instance document, it again works.
(However, other errors will then be reported--another issue.)
Can you help me to find out what is wrong? Is it my error or a bug?
Thanks, kind regards,
Miklos HERBOLY
Edited by: mh**** on Jul 3, 2011 10:55 AMThis is Oracle feature (at least in 11g R2). See Working with Timezones from XML DB Developer's Guide: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16659/xdb05sto.htm#autoId62
The chapter also includes an example how to adjust the schema with Oracle specific annotation.
See also http://stackoverflow.com/questions/6370035/why-dbms-xmlschema-fails-to-validate-a-valid-xsdatetime/6382096#6382096
Edited by: 836290 on Jul 4, 2011 7:56 AM -
Unable to load into XMLTYPE column: enumeration value considered as boolean
HI Gentlemen,
I have a problem with my XMLTYPE load procedure. The schemas have been registered:
SQL> select any_path from resource_view where any_path like '%GKSADMIN/ICD%';
ANY_PATH
/sys/schemas/GKSADMIN/ICD
/sys/schemas/GKSADMIN/ICD/datentypen_V1.40.xsd
/sys/schemas/GKSADMIN/ICD/ehd_header_V1.40.xsd
/sys/schemas/GKSADMIN/ICD/ehd_root_V1.40.xsd
/sys/schemas/GKSADMIN/ICD/icd_body.xsd
/sys/schemas/GKSADMIN/ICD/icd_header.xsd
/sys/schemas/GKSADMIN/ICD/icd_root.xsd
/sys/schemas/GKSADMIN/ICD/keytabs_V1.40.xsd
8 Zeilen ausgewählt.The table has been created:
SQL> describe icd
Name Null? Typ
ID CHAR(2)
XML_DOCUMENT SYS.XMLTYPE(XMLSchema "ICD/i
cd_root.xsd" Element "ehd")
STORAGE Object-relational TY
PE "ICD$ICD_ROOT_TYP"And I try to insert an instance document:
SQL> @loadxmlfileascolumn_int
Geben Sie einen Wert für source_directory ein: c:\gks\kbv\c\icd\xml
alt 1: create or replace directory SOURCE_DIR as '&source_directory'
neu 1: create or replace directory SOURCE_DIR as 'c:\gks\kbv\c\icd\xml'
Verzeichnis wurde erstellt.
Geben Sie einen Wert für xmltypetable ein: icd
alt 4: INSERT INTO &XMLTypeTable
neu 4: INSERT INTO icd
Geben Sie einen Wert für id ein: 01
Geben Sie einen Wert für instancedocument ein: icdtest.xml
alt 5: VALUES (&id, XMLType(bfilename('SOURCE_DIR', '&InstanceDocument'),
neu 5: VALUES (01, XMLType(bfilename('SOURCE_DIR', 'icdtest.xml'),
declare
FEHLER in Zeile 1:
ORA-31038: Ungültiger boolean Wert: "j"
ORA-06512: in Zeile 4
SQL> spool offAs the schemas are very big, i copied only relevant parts of them to show how the values are defined (in icd_body.xsd):
<xs:element name="abrechenbar">
<xs:annotation>
<xs:documentation>Kennzeichnung, ob (abrechenbarer) ICD-10-GM-Code</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="V" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="j"/>
<xs:enumeration value="n"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
SQL> spool off
"j" and "n" are for Yes and No in German. But anyway, how could it become a Boolean? Why is it invalid?
Can you please help me so that I can load XMLTYPE contents?
Thanks, regards
Miklos HERBOLY
Sorry, I found one place where a boolean will be expected. I modified in the instance document so that it has true or false. And still something is recognized as boolean with the value of "j".
Edited by: mh**** on Jul 4, 2011 4:43 AM
Edited by: mh**** on Jul 4, 2011 5:07 AMI don't get it, it should work, right? Although I am not sure if a XMLType Object Relational column is supported, but then again this is not clear in the documentation.
The only thing I can think of is that the attribute "V" is enforced as a boolean in the database on lower Object Relational level or... -
ORA-00911:invalid character when loading an XML doc to the XMLType column
We have followed this code snippet: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/Example_Code.html#createclob
using the CLOB object to load an XML Document which has more 4000 characters to the XMLType column, we got the error -- ORA-00911:invalid character.
Sound likes an encoding issue? any suggestions would be appreciated.
BTW, we're able to use the TopLink's mapping -- Direct-to-Field to insert an XML String (<4000 characters) to the XMLType column.
Thanks!Try removing the semi-colon at the end of your statement. That is the cause of ORA-911 with DBMS_SQL.PARSE and EXECUTE IMMEDIATE, I don't see why ADO should be any different.
Cheers, APC -
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.
Maybe you are looking for
-
WebDynpro Exception: ADS: Request start time, start Interactive Form
Hello everybody, I tried out to display an interactive form in Web Dynpro for ABAP like in Thomas Jungs video described. But I when I start my application I get everytime the dump. I read not 944221 and and thats works all. But when I try the testpro
-
Problem in London/ South of England. Terrible serv...
Hi there, I have a very very diminished speed on my broadband at the moment in London. I rang BT last night around 9pm and they said there was a fault with all 02 numbers that would be fixed within 12 hours and that they would phone me back today. I
-
Im saving audio files from garage band by sharing them or saving to disk.. its seems that every time i do this there is an extra 4 seconds added on to each song i make. I need an exact ending when the instruments end because i am sampling these audio
-
My Lightroom is: 5.3 64 bits I bought it in the last promotion with the Photoshop My OS is Windows 8 I can't open the Lightroom, it appears a message saying "corrupt catalog detected" (in Spanish) and even give you repair, display, etc .... I can not
-
Seidio Case for Extended Battery - Good Price
Well, I decided to bite the bullet and get the extended battery. I was getting about a full day on the regular battery using 3G and, if today is any indication, I will get about a full day on the extended battery using 4G, which I left it on today.