Getting large XmlType column content
Help!
I have table with XMLType column, and when fetch date, see an error message like buffer to small (ora 19011). How can i fetch date content to clob or anythig else...
Or what is a better solution?
Anton,
Using the "oerr" utility on my Oracle 9i (9.2.0.4) database (on SUN [sparc] Solaris 9), I get the following output:
19011, 00000, "Character string buffer too small"
// *Cause: The string result asked for is too big to return back
// *Action: Get the result as a lob insteadSo have you tried using a [c]lob, instead?
I think there may be some sample code on the OTN Web site. Have a look here:
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/index.html
Good Luck,
Avi.
Similar Messages
-
ORA-00600 occurs on an extract from a large xmlType column
When running the extract() function where search criteria has been specified (for an existing node), I receive the following error:
ORA-00600: internal error code, arguments: [qmxdMatchingChildren:overflow-1],[], [], [], [], [], [], []
However, if I remove the search criteria, the fragment returns no error.
Both queries have been working successfully on smaller documents.
Example with criteria:
SELECT extract(tab.xml_text,'//item[@val="2.1.2.2"]') ITEM
FROM CUR.ITEMS tab
WHERE item_id =271;
Example without criteria:
SELECT extract(tab.xml_text,'//item') ITEM
FROM CUR.ITEMS tab
WHERE item_id =271;
I'm estimating that the document inside the xmltype column is 4MB.
The database is Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production With the Partitioning, OLAP and Data Mining options.Jennifer,
You may be encountering the following bug:
Bug# 3617191 See Note 3617191.8
OERI[qmxdmatchingchildren:overflow-1] using EXTRACT from large XML document
Fixed: 10.1.0.4, 10.2 -
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. -
Problems sorting larger sets of XMLType columns/tables
Hi,
Here's something I tried to wrap my head around:
I'm using Oracle 11g r1 for Windows Server 2003.
I've imported a fairly large set of XML files into a temporary XMLType table. Now
I want to sort the contents of the table and put them into another table which
uses a sequence to get primary keys (would be a longer story to explain, basically
sorting by this non-XML primary key is super-fast as opposed to everything else
I've tried, plus I need something unique):
INSERT INTO realtable SELECT 0, object_value
FROM tmptable ORDER BY extractValue(object_value, '/some/*/field');It works fine for a very small number of rows but when I tried with about 30000 rows,
still not too much, two kinds of things can happen. Either, Oracle gobbles up a huge amount
of memory (>1,5GB) until the statement breaks:
ORA-04030: Zu wenig Prozessspeicher fⁿr Versuch 33292 Bytes zuzuweisen
(callheap,kllcqgf:kllsltba)Or I get something like this:
ORA-00600: Interner Fehlercode, Argumente: [kqludp2], [0x1F31EC94], [0], [], [], [], [], []I haven't wasted too much time looking into this. I tried storage options clob and binary xml
for tmptable. Clob seems to induce the latter problem and binary xml the former but I haven't
made further experiments.
I can create a workaround from outside Oracle I think, so it's not serious however I'd would
be interesting to know what happened or if there is a better way to do this.
Thanks!Unfortunately, the problems are not reproducible in a meaningful way. All I can say is that once a statement will result in a kqludp2, it will always fail with the exactly same error message until I reinstall the database from scratch. On the other
side, when I found a configuration that works, I could delete and rebuild/refill a table multiple times without the thing ever breaking.
As the most recent example, after the latest trouble I deleted the database and changed my DDL scripts to the last configuration I wanted to try and broke the last time (several tables with two normal columns and an XMLType column each), everything worked like a breeze.
I can file a TAR when I get a support ID from my employer, however I installed the database on a virtual machine (I should have mentioned that earlier) and Oracle doesn't officially support that configuration from what I know so I'll doubt they'll do anything about it. I've procured a physical computer now and try to reproduce any of the problems when I get to it. -
How to insert large xml file ino xmltype column
Hi all,
iam using oracle10g. I have a table example1(key_column varchar2(10),xml_column xmltype) like this. i want to insert xml file from server to xmltype column. Can you please anybody suggest regarding this.wht is the size of the xmltype column. is it same as clob like 2GB or sth different. and one more thing is iam creating one procedure in that procedure , in that we are fetching xmltype value into clob varable. is it correct or not...
ThanksManipulating a single XMLType of 2GB is probably not sensible period. I'm guessing that the content of a file that big is probably a set of smaller XML documents which someone has wrapped a begin and end tag around. Since databases are good at handling collections of documents (or collections of anything else for that matter), you should consider de-compising the large document back into a set of smaller documents before storing it in the database
-
How to insert large xml file to XMLType column?
Hi,
I have a table with one column as XMLType(Binary XML storage option and Free Text Indexing). When i try to insert a large XML as long as 8kb, i'm getting an error ORA-01704:string literal too long.
Insert into TEST values(XMLTYPE('xml HERE'));
How to insert large XML values to XMLType column?
Regards,
SprighteeFor a large XML file, you basically have two options - you can load the string directly as an XMLType, or you can load the string as a CLOB and cast it on the database side to an XMLType.
If you decide to load the XML as XmlType client-side, then you may be interested to know that versions of Oracle after 11.2.0.2 support the JDBC 4.0 SQLXML standard. See the JDBC driver release documentation here:
http://docs.oracle.com/cd/E18283_01/java.112/e16548/jdbcvers.htm#BABGHBCC
If you want to load as a CLOB, then you'll need to use PreparedStatement's setClob() method, or allocate an oracle.sql.clob object.
For versions before 11.2.0.2, you can create an XMLType with a constructor that includes an InputStream or byte[] array.
HTH
Edited by: 938186 on Jun 23, 2012 11:43 AM -
I am getting error "ORA-12899: value too large for column".
I am getting error "ORA-12899: value too large for column" after upgrading to 10.2.0.4.0
Field is updating only through trigger with hard coded value.
This happens randomly not everytime.
select * from v$version
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
Table Structure
desc customer
Name Null? Type
CTRY_CODE NOT NULL CHAR(3 Byte)
CO_CODE NOT NULL CHAR(3 Byte)
CUST_NBR NOT NULL NUMBER(10)
CUST_NAME CHAR(40 Byte)
RECORD_STATUS CHAR(1 Byte)
Trigger on the table
CREATE OR REPLACE TRIGGER CUST_INSUPD
BEFORE INSERT OR UPDATE
ON CUSTOMER FOR EACH ROW
BEGIN
IF INSERTING THEN
:NEW.RECORD_STATUS := 'I';
ELSIF UPDATING THEN
:NEW.RECORD_STATUS := 'U';
END IF;
END;
ERROR at line 1:
ORA-01001: invalid cursor
ORA-06512: at "UPDATE_CUSTOMER", line 1320
ORA-12899: value too large for column "CUSTOMER"."RECORD_STATUS" (actual: 3,
maximum: 1)
ORA-06512: at line 1
Edited by: user4211491 on Nov 25, 2009 9:30 PM
Edited by: user4211491 on Nov 25, 2009 9:32 PMSQL> create table customer(
2 CTRY_CODE CHAR(3 Byte) not null,
3 CO_CODE CHAR(3 Byte) not null,
4 CUST_NBR NUMBER(10) not null,
5 CUST_NAME CHAR(40 Byte) ,
6 RECORD_STATUS CHAR(1 Byte)
7 );
Table created.
SQL> CREATE OR REPLACE TRIGGER CUST_INSUPD
2 BEFORE INSERT OR UPDATE
3 ON CUSTOMER FOR EACH ROW
4 BEGIN
5 IF INSERTING THEN
6 :NEW.RECORD_STATUS := 'I';
7 ELSIF UPDATING THEN
8 :NEW.RECORD_STATUS := 'U';
9 END IF;
10 END;
11 /
Trigger created.
SQL> insert into customer(CTRY_CODE,CO_CODE,CUST_NBR,CUST_NAME,RECORD_STATUS)
2 values('12','13','1','Mahesh Kaila','UPD');
values('12','13','1','Mahesh Kaila','UPD')
ERROR at line 2:
ORA-12899: value too large for column "HPVPPM"."CUSTOMER"."RECORD_STATUS"
(actual: 3, maximum: 1)
SQL> insert into customer(CTRY_CODE,CO_CODE,CUST_NBR,CUST_NAME)
2 values('12','13','1','Mahesh Kaila');
1 row created.
SQL> set linesize 200
SQL> select * from customer;
CTR CO_ CUST_NBR CUST_NAME R
12 13 1 Mahesh Kaila I
SQL> update customer set cust_name='tst';
1 row updated.
SQL> select * from customer;
CTR CO_ CUST_NBR CUST_NAME R
12 13 1 tst Urecheck your code once again..somewhere you are using record_status column for insertion or updation.
Ravi Kumar -
Getting error ORA-01401: inserted value too large for column
Hello ,
I have Configured the scenario IDOC to JDBC .In the SXMB_MONI am getting the succes message .But in the Adapter Monitor am getting the error message as
ORA-01401: inserted value too large for column and the entries also not inserted in to the table.I hope this is because of the date format only.In Oracle table date field has defined in the format of '01-JAN-2005'.I am also passing the date field in the same format only for INVOICE_DATE and INVOICE_DUE_DATE.Please see the target structure .
<?xml version="1.0" encoding="UTF-8" ?>
- <ns:INVOICE_INFO_MT xmlns:ns="http://sap.com/xi/InvoiceIDoc_Test">
- <Statement>
- <INVOICE_INFO action="INSERT">
- <access>
<INVOICE_ID>0090000303</INVOICE_ID>
<INVOICE_DATE>01-Dec-2005</INVOICE_DATE>
<INVOICE_DUE_DATE>01-Jan-2005</INVOICE_DUE_DATE>
<ORDER_ID>0000000000011852</ORDER_ID>
<ORDER_LINE_NUM>000010</ORDER_LINE_NUM>
<INVOICE_TYPE>LR</INVOICE_TYPE>
<INVOICE_ORGINAL_AMT>10000</INVOICE_ORGINAL_AMT>
<INVOICE_OUTSTANDING_AMT>1000</INVOICE_OUTSTANDING_AMT>
<INTERNAL_USE_FLG>X</INTERNAL_USE_FLG>
<BILLTO>0004000012</BILLTO>
<SHIPTO>40000006</SHIPTO>
<STATUS_ID>O</STATUS_ID>
</access>
</INVOICE_INFO>
</Statement>
</ns:INVOICE_INFO_MT>
Please let me know what are all the possible solution to fix the error and to insert the entries in the table.
Thanks in Advance!Hi muthu,
// inserted value too large for column
When your oracle insertion throws this error, it implies that some value that you are trying to insert into the table is larger than the allocated size.
Just check the format of your table and the respective size of each field on your oracle cleint by using the command,
DESCRIBE <tablename> .
and then verify it with the input. I dont think the problem is with the DATE format because if it is not a valid date format, you would have got on error like
String Literal does not match type
Hope this helps,
Regards,
Bhavesh -
Getting the system generated column name for xmltype column
Hello,
how i can get the internal column name (p.a. SYS_NC00001$) for a xmltype column? I cannot find a correct dictionary view .
I need that for moving a xmltype lob partition to another tablespace.
Thanks,
MaikRDoes the following help:
http://www.idevelopment.info/data/Oracle/DBA_tips/LOBs/LOBS_2.shtml
http://www.liberidu.com/blog/?p=264 -
Get xmlType column into xsql page
I have a table with normal columns such as string types, plus one xmlType column.
For example, the xmltype column can be <mark>ibm</mark>.
In xsql page, I tried to select all the columns out (including the xmltype col).
I want the xml column as part of the final xml output such as:
<?xml version="1.0" encoding="ISO-8859-1"?>
<page>
<ROWSET>
<ROW num="1">
<xmlcolumn>
<mark>ibm</mark>
</xmlcolumn>
</ROW>
</ROWSET>
</page>
I found out that I can't just do:
select t.xmlcolumn from table t;
The page complain that can't convert xmlType to string.
So I did
select t.xmlcolumn.getClobString() as xmlcolumn from table t;
However I got:
<?xml version="1.0" encoding="ISO-8859-1"?>
<page>
<ROWSET>
<ROW num="1">
<xmlcolumn><mark>ibm&/lt;mark>
</xmlcolumn>
</ROW>
</ROWSET>
</page>
It seems that xsql translate the <mark>ibm</mark> to real String instead of integrate it into the final xml string.
Does anyone know how to do this?
Thanks a lot.
Kai.hi
I have this:
CREATE TABLE XML_TAB (XMLVAL XMLTYPE);
INSERT INTO XML_TAB VALUES (XMLTYPE('<EMP><EMPNO>666</EMPNO><ENAME>Jef</ENAME></EMP>'));
INSERT INTO XML_TAB VALUES (XMLTYPE('<EMP><EMPNO>777</EMPNO><ENAME>Jan</ENAME></EMP>'));So in SQL*Plus "SELECT XMLVAL FROM XML_TAB" gives:
XMLVAL
<EMP>
<EMPNO>666</EMPNO>
<ENAME>Jef</ENAME>
</EMP>
<EMP>
<EMPNO>777</EMPNO>
<ENAME>Jan</ENAME>
</EMP>If I try this test1.xsql:
<xsql:query connection="my_conn" xmlns:xsql="urn:oracle-xsql">
SELECT XMLVAL FROM XML_TAB
</xsql:query>I get java.lang.NoClassDefFoundError: oracle/xdb/XMLType
If I try this test2.xsql:
<xsql:query connection="my_conn" xmlns:xsql="urn:oracle-xsql">
SELECT (XMLVAL).getClobVal() AS XMLVAL FROM XML_TAB
</xsql:query>I get this "escaped output":
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<XMLVAL>&lt;EMP>&lt;EMPNO>666&lt;/EMPNO>&lt;ENAME>Jef&lt;/ENAME>&lt;/EMP></XMLVAL>
</ROW>
<ROW num="2">
<XMLVAL>&lt;EMP>&lt;EMPNO>777&lt;/EMPNO>&lt;ENAME>Jan&lt;/ENAME>&lt;/EMP></XMLVAL>
</ROW>
</ROWSET>But I want this, just XML:
<?xml version="1.0" ?>
<ROWSET>
<ROW num="1">
<XMLVAL><EMP><EMPNO>666</EMPNO><ENAME>Jef</ENAME></EMP></XMLVAL>
</ROW>
<ROW num="2">
<XMLVAL><EMP><EMPNO>777</EMPNO><ENAME>Jan</ENAME></EMP></XMLVAL>
</ROW>
</ROWSET>So if I understand your suggestion and try this wrapper.xsql:
<xsql:include-xsql xmlns:xsql="urn:oracle-xsql" href="test2.xsql" reparse="yes"/>... I still get the same "escaped output" as above
In the xsu12.jar I use is a file named "XSU12_VERSION_9_2_0_1_0_rdbms", does this tell me anything about the version?
What am I doing wrong here?
tnx
-Jan -
The simplest way to get more performance on select on xmltype column?
We have a table with xmltype column:
CREATE TABLE "TK"."PLAN_2" ("UNID" NUMBER NOT
NULL,
"XMLSTRING" "TK"."XMLTYPE",
CONSTRAINT "SYS_C001142583" PRIMARY KEY("UNID")
USING INDEX
TABLESPACE "TX"
STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0) PCTFREE 10 INITRANS 2 MAXTRANS 255)
The data in column xmlstring looks like this:
<Agent>
<OP End="2520000" Id="001_8232_0_91" Origin="Autos" Quantity="1.0 ea" Start="2520000">
<OSP Key="ADM_ID" String="001_8232_0" />
<OSP Key="AddAutoNr" String="0" />
<OSP Key="CURRENT_STATE" String="Tages-Vorgabe" />
<OLP Key="ChUser">
<OIP Key="(T_SP) test2" Long="1218125408541" />
<OIP Key="(T_SP) admin" Long="1219071385346" />
<OIP Key="(T_SP) test2" Long="1237540381906" />
</OLP>
<OSP Key="Debicode" String="9903" />
<OSP Key="Resource" String="SBN" />
<OSP Key="TrafficDay" String="91" />
<OSP Key="AutoNrSchema" String="001" />
<OSP Key="AutoNumber" String="8232" />
<OPE End="0" Id="Prod" Origin="Autos|Prod" Start="0">
<OProd Duration="0" End="0" Id="Produce" OriginDirect="Autos|Prod|Produce" Quantity="1.0 ea" Start="0" Type="Produce">
<OSP Key="RESelection.Parameter" String="Resource" />
<Resource Id="Autos" />
<Alloc From="OP|001_8232_0_91|Prod|Produce" Id="" Quantity="1.0 ea" To="CO|001_8232_0_91|001_8232_0_91" Type="PRODUCEREQ_TO_CONSUMEREQ" />
</OProd>
</OPE>
<OPE End="2520000" Id="Step_0" Origin="Autos|Step" Start="0">
<OQP Key="Delay" Overridden="true" Quantity="0.0 s" />
<OQP Key="Distance" Quantity="44.84 km" />
<OQP Key="Duration" Quantity="2520.0 s" />
<OQP Key="Fahrt" Quantity="2520.0 s" />
<OSP Key="From" String="BS" />
<OSP Key="I1" String="0" />
<OSP Key="PLACE" String="1" />
<OQP Key="StartDelay" Overridden="true" Quantity="0.0 s" />
<OQP Key="TWait" Overridden="true" Quantity="0.0 s" />
<OSP Key="To" String="OL" />
<OUse Duration="2520000" End="2520000" Id="LStep_0" Name="L" OriginDirect="Autos|Step|LStep" Quantity="1.0 ea" Start="0" Type="Step">
<OSP Key="I2" String="0" />
<OIP Key="LPOSITION" Long="1" Overridden="true" />
<OSP Key="PLACE" String="1" />
<OQP Key="Wait" Overridden="true" Quantity="0.0 s" />
<Resource Id="vs_RABe525_13" />
</OUse>
<OUse Duration="480000" End="0" Id="LPre_0" Name="L" OriginDirect="Autos|Step|LPre" Quantity="1.0 ea" Start="-480000" Type="Pre">
<OQP Key="Fahrbereit" Overridden="true" Quantity="2 min" />
<OSP Key="From" Overridden="true" String="BS" />
<OSP Key="I2" String="0" />
<OSP Key="PLACE" String="1" />
<OSP Key="StepIndex" String="0" />
<OSP Key="To" Overridden="true" String="BS" />
<OQP Key="Vorbereitung" Overridden="true" Quantity="6 min" />
<Resource Id="vs_RABe525_13" />
</OUse>
<OUse Duration="600000" End="3120000" Id="LPost_0" Name="L" OriginDirect="Autos|Step|LPost" Quantity="1.0 ea" Start="2520000" Type="Post">
<OQP Key="Abstellzeit" Overridden="true" Quantity="4 min" />
<OSP Key="From" Overridden="true" String="OL" />
<OSP Key="I2" String="0" />
<OQP Key="Nachbereitung" Overridden="true" Quantity="6 min" />
<OSP Key="PLACE" String="1" />
<OSP Key="StepIndex" String="0" />
<OSP Key="To" Overridden="true" String="OL" />
<Resource Id="vs_RABe525_13" />
</OUse>
<OUse Duration="2520000" End="2520000" Id="FStep_0" Name="F" OriginDirect="Autos|Step|FStep" Quantity="1.0 ea" Start="0" Type="Step">
<OSP Key="I2" String="0" />
<OSP Key="PLACE" String="1" />
<OQP Key="Wait" Overridden="true" Quantity="0.0 s" />
<Resource Id="ps_P112" />
</OUse>
<OUse Duration="480000" End="0" Id="FPre_0" Name="F" OriginDirect="Autos|Step|FPre" Quantity="1.0 ea" Start="-480000" Type="Pre">
<OQP Key="Fahrbereit" Overridden="true" Quantity="2 min" />
<OSP Key="From" Overridden="true" String="BS" />
<OSP Key="I2" String="0" />
<OSP Key="PLACE" String="1" />
<OSP Key="StepIndex" String="0" />
<OQP Key="Taxi" Overridden="true" Quantity="0 s" />
<OSP Key="To" Overridden="true" String="BS" />
<OQP Key="Vorbereitung" O verridden="true" Quantity="6 min" />
<OQP Key="Wegzeit" Overridden="true" Quantity="0 s" />
<Resource Id="ps_P112" />
</OUse>
<OUse Duration="600000" End="3120000" Id="FPost_0" Name="F" OriginDirect="Autos|Step|FPost" Quantity="1.0 ea" Start="2520000" Type="Post">
<OQP Key="Abstellzeit" Overridden="true" Quantity="4 min" />
<OSP Key="From" Overridden="true" String="OL" />
<OSP Key="I2" String="0" />
<OQP Key="Nachbereitung" Overridden="true" Quantity="6 min" />
<OSP Key="PLACE" String="1" />
<OSP Key="StepIndex" String="0" />
<OQP Key="Taxi" Overridden="true" Quantity="0 s" />
<OSP Key="To" Overridden="true" String="OL" />
<OQP Key="Wegzeit" Overridden="true" Quantity="0 s" />
<Resource Id="ps_P112" />
</OUse>
</OPE>
</OP>
</Agent>
We try to select:
SELECT UNID, extractValue(value(OUSE_XMLSTRING), '/OUse/Resource/@Id') OUSE_RESOURCE,
extract(XMLSTRING, '/Agent/OP/OSP[@Key = "TrafficDay"]/@String') TT_DAY,
extract(XMLSTRING, '/Agent/OP/@Start') OP_START,
extract(XMLSTRING, '/Agent/OP/@End') OP_END,
extract(XMLSTRING, '/Agent/OP/OSP[@Key = "ADM_ID"]/@String') ADM_ID,
extractValue(value(OUSE_XMLSTRING), '/OUse/@Start') OUSE_START,
extractValue(value(OUSE_XMLSTRING), '/OUse/@End') OUSE_END
FROM tk.plan_2, table(XMLSequence(extract(XMLSTRING, '//Agent/OP//OPE//OUse'))) OUSE_XMLSTRING
where extractValue(value(OUSE_XMLSTRING), '/OUse/Resource/@Id') = 'vs_RABe525_13';
with this explain plan:
PLAN_TABLE_OUTPUT
Plan hash value: 3476314316
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 101 | 22018 | 31 (0)| 00:00:01 |
| 1 | NESTED LOOPS | | 101 | 22018 | 31 (0)| 00:00:01 |
| 2 | TABLE ACCESS FULL | PLAN_2 | 2 | 432 | 2 (0)| 00:00:01 |
|* 3 | COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE | | | | |
Predicate Information (identified by operation id):
3 - filter(EXTRACTVALUE(VALUE(KOKBF$),'/OUse/Resource/@Id')='vs_RABe525_13')
We want to select on the 'ID', which occurs more than once in the xmlstring and the table gonna be big, so we think we need some kind of index on the ID-Identifier. What will be the best way to do this?Which version of Oracle (4 digits)?
If 10.2 or greater, look into using XMLTable and that is the replacement for the table(XMLSequence(extract()) approach. Also, avoid the use of // unless you really need it. I doubt it will make a difference in your situation but just a good performance approach in general.
We want to select on the 'ID', which occurs more than once in the xmlstringI assume you are going to want the count(...) > 1 from the XML to tell you which you are selecting?
I also have questions about what that XMLType is being stored as but that depends upon what your version is regarding what storage options you have.
Edited by: A_Non on Jun 7, 2010 10:55 AM
Forgot to add, look in the FAQ (under your sign-in name on the upper right) for how to use the tag to better format your posts. -
Insert performance on a table with schema based XMLType column
Hi,
We are inserting around 500K rows into a table which has one XMLType column (schema based). Schema is simple and the size of the XMLType column is also not very large (on an average only around 100 bytes (max might be around 1k-2k), but it takes around 1 hr for every 20K rows, which seems very slow.
The schema is like this :
<schema targetNamespace="http://www.citadon.com/xml/test.xsd"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
xdb:storeVarrayAsTable="true"
version="1.0" elementFormDefault="qualified">
<element name="cas">
<complexType>
<sequence>
<element name="ca" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="id" type="string"/>
<element name="value" type="string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>
Any thoughts on how to improve performance?
-SriniYou need to have sufficient data.. Also the event show in the following code may help depending on the nature of the query....
Note in the PurchaseOrder Example if I only have 133 docs, instead of 10,000 I will get tablescan and index full scans
C:\oracle\xdb\bugs\xdbBasicDemo>sqlplus /nolog @testcase XDBTEST XDBTEST
SQL*Plus: Release 10.1.0.3.0 - Production on Fri Aug 27 22:57:36 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
SQL> spool testcase.log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> set long 10000
SQL> set pages 10000
SQL> set feedback on
SQL> set lines 132
SQL> set pages 50
SQL> --
SQL> drop index iPartNumberIndex
2 /
Index dropped.
Elapsed: 00:00:02.25
SQL> alter index LINEITEM_LIST rebuild
2 /
Index altered.
Elapsed: 00:00:02.15
SQL> desc PURCHASEORDER
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://localhost:8080/home/SCOTT/poSource/xsd/purchaseOrder.xsd" Element "Pu
ject-relational TYPE "PURCHASEORDER_T"
SQL> --
SQL> col level format 99999
SQL> col parent_table_column format A32
SQL> col table_name format A32
SQL> col table_type_name format A32
SQL> --
SQL> select level, PARENT_TABLE_COLUMN, TABLE_TYPE_NAME, TABLE_NAME
2 from USER_NESTED_TABLES
3 connect by PRIOR TABLE_NAME = PARENT_TABLE_NAME
4 start with PARENT_TABLE_NAME = 'PURCHASEORDER'
5 /
LEVEL PARENT_TABLE_COLUMN TABLE_TYPE_NAME TABLE_NAME
1 "XMLDATA"."ACTIONS"."ACTION" ACTION_V ACTION_TABLE
1 "XMLDATA"."LINEITEMS"."LINEITEM" LINEITEM_V LINEITEM_TABLE
2 rows selected.
Elapsed: 00:00:13.60
SQL> desc LINEITEM_T
LINEITEM_T is NOT FINAL
Name Null? Type
SYS_XDBPD$ XDB.XDB$RAW_LIST_T
ITEMNUMBER NUMBER(38)
DESCRIPTION VARCHAR2(256 CHAR)
PART PART_T
SQL> --
SQL> desc PART_T
PART_T is NOT FINAL
Name Null? Type
SYS_XDBPD$ XDB.XDB$RAW_LIST_T
PART_NUMBER VARCHAR2(14 CHAR)
QUANTITY NUMBER(12,2)
UNITPRICE NUMBER(8,4)
SQL> --
SQL> select count(*)
2 from purchaseorder
3 /
COUNT(*)
10000
1 row selected.
Elapsed: 00:00:05.31
SQL> select count(*)
2 from purchaseorder,
3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
4 /
COUNT(*)
148814
1 row selected.
Elapsed: 00:09:40.54
SQL> create index iPartNumberIndex
2 on LINEITEM_TABLE l
3 ( l.PART.PART_NUMBER,NESTED_TABLE_ID)
4 /
Index created.
Elapsed: 00:00:36.11
SQL> explain plan for
2 select count(*)
3 from purchaseorder
4 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
5 /
Explained.
Elapsed: 00:00:01.14
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2571550067
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 116 | 93 (2)| 00:00:02 |
| 1 | SORT AGGREGATE | | 1 | 116 | | |
| 2 | NESTED LOOPS | | 25 | 2900 | 93 (2)| 00:00:02 |
| 3 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
|* 6 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 49 | 1 (0)| 00:00:01 |
|* 7 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("SYS_NC00011$"='717951002372')
5 - access("SYS_NC00011$"='717951002372')
6 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
ies/><read-contents/></privilege>''))=1)
7 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
26 rows selected.
Elapsed: 00:00:03.12
SQL> select count(*)
2 from purchaseorder
3 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
4 /
COUNT(*)
33
1 row selected.
Elapsed: 00:00:04.63
SQL> select count(*)
2 from purchaseorder,
3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
5 /
COUNT(*)
33
1 row selected.
Elapsed: 00:00:00.32
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2571550067
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 116 | 93 (2)| 00:00:02 |
| 1 | SORT AGGREGATE | | 1 | 116 | | |
| 2 | NESTED LOOPS | | 25 | 2900 | 93 (2)| 00:00:02 |
| 3 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
|* 6 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 49 | 1 (0)| 00:00:01 |
|* 7 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("SYS_NC00011$"='717951002372')
5 - access("SYS_NC00011$"='717951002372')
6 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
ies/><read-contents/></privilege>''))=1)
7 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
26 rows selected.
Elapsed: 00:00:00.04
SQL> explain plan for
2 select extractValue(object_value,'/PurchaseOrder/Reference')
3 from purchaseorder,
4 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
5 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
6 /
Explained.
Elapsed: 00:00:00.07
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 713363872
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 25 | 8000 | 104 (0)| 00:00:02 |
| 1 | NESTED LOOPS | | 25 | 8000 | 104 (0)| 00:00:02 |
|* 2 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
|* 4 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 253 | 1 (0)| 00:00:01 |
|* 5 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("SYS_NC00011$"='717951002372')
3 - access("SYS_NC00011$"='717951002372')
4 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
ties/><read-contents/></privilege>''))=1)
5 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
24 rows selected.
Elapsed: 00:00:00.04
SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
2 from purchaseorder,
3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
5 /
EXTRACTVALUE(OBJECT_VALUE,'/PU
MWEISS-20030616154327385GMT
NSARCHAN-20030703170041824GMT
HBAER-20030206173836987GMT
LOZER-20031110131149107GMT
WTAYLOR-20030120174534374GMT
MHARTSTE-20031103172937613GMT
KGEE-20030919215826550GMT
PSULLY-20030712141634504GMT
JPATEL-20030630175356693GMT
RMATOS-2003072920455000GMT
DRAPHEAL-20030528180033254GMT
JRUSSEL-20031121213026539GMT
PTUCKER-20030918160532301GMT
SVOLLMAN-20031027120838903GMT
WGIETZ-20030208185026303GMT
TFOX-20030110164614994GMT
JPATEL-20030304214301386GMT
GGEONI-20030606135257846GMT
STOBIAS-20030817120358785GMT
COLSEN-20030525200717658GMT
SBAIDA-20030224182546606GMT
IMIKKILI-20030118180347537GMT
ABULL-20030429162730766GMT
NSARCHAN-20031113183134873GMT
LBISSOT-20030809134114505GMT
JKING-20030420162058859GMT
JMALLIN-20030506152048261GMT
AFRIPP-20030311153808601GMT
SHIGGINS-20030831151756257GMT
DBERNSTE-20030626122725631GMT
KPARTNER-20031021160248962GMT
ABANDA-2003062721524842GMT
DOCONNEL-20030904214708637GMT
33 rows selected.
Elapsed: 00:00:00.07
SQL> explain plan for
2 select extractValue(object_value,'/PurchaseOrder/Reference')
3 from purchaseorder
4 where existsNode
5 (
6 object_value,
7 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
8 ) = 1
9 /
Explained.
Elapsed: 00:00:00.02
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 849879259
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 25 | 8000 | 93 (2)| 00:00:02 |
| 1 | NESTED LOOPS | | 25 | 8000 | 93 (2)| 00:00:02 |
| 2 | SORT UNIQUE | | 25 | 1675 | 79 (0)| 00:00:01 |
|* 3 | INDEX UNIQUE SCAN | LINEITEM_DATA | 25 | 1675 | 79 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | | 3 (0)| 00:00:01 |
|* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 253 | 1 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
3 - access("SYS_NC00011$"='717951002372')
4 - access("SYS_NC00011$"='717951002372')
5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
ties/><read-contents/></privilege>''))=1)
6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
25 rows selected.
Elapsed: 00:00:00.03
SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
2 from purchaseorder
3 where existsNode
4 (
5 object_value,
6 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
7 ) = 1
8 /
EXTRACTVALUE(OBJECT_VALUE,'/PU
MWEISS-20030616154327385GMT
NSARCHAN-20030703170041824GMT
HBAER-20030206173836987GMT
LOZER-20031110131149107GMT
WTAYLOR-20030120174534374GMT
MHARTSTE-20031103172937613GMT
KGEE-20030919215826550GMT
PSULLY-20030712141634504GMT
JPATEL-20030630175356693GMT
RMATOS-2003072920455000GMT
DRAPHEAL-20030528180033254GMT
JRUSSEL-20031121213026539GMT
PTUCKER-20030918160532301GMT
SVOLLMAN-20031027120838903GMT
WGIETZ-20030208185026303GMT
TFOX-20030110164614994GMT
JPATEL-20030304214301386GMT
GGEONI-20030606135257846GMT
STOBIAS-20030817120358785GMT
COLSEN-20030525200717658GMT
SBAIDA-20030224182546606GMT
IMIKKILI-20030118180347537GMT
ABULL-20030429162730766GMT
NSARCHAN-20031113183134873GMT
LBISSOT-20030809134114505GMT
JKING-20030420162058859GMT
JMALLIN-20030506152048261GMT
AFRIPP-20030311153808601GMT
SHIGGINS-20030831151756257GMT
DBERNSTE-20030626122725631GMT
KPARTNER-20031021160248962GMT
ABANDA-2003062721524842GMT
DOCONNEL-20030904214708637GMT
33 rows selected.
Elapsed: 00:00:00.04
SQL> alter session set events ='19027 trace name context forever, level 0x800000'
2 /
Session altered.
Elapsed: 00:00:00.00
SQL> explain plan for
2 select count(*)
3 from purchaseorder
4 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
5 /
Explained.
Elapsed: 00:00:00.03
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 3049344732
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 69 | 17 (6)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 69 | | |
| 2 | NESTED LOOPS | | 25 | 1725 | 17 (6)| 00:00:01 |
| 3 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
|* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 39 | 1 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("SYS_NC00011$"='717951002372')
5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
ies/><read-contents/></privilege>''))=1)
6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
24 rows selected.
Elapsed: 00:00:00.03
SQL> select count(*)
2 from purchaseorder
3 where existsNode(object_value,'/PurchaseOrder/LineItems/LineItem[Part/@Id="717951002372"]') = 1
4 /
COUNT(*)
33
1 row selected.
Elapsed: 00:00:00.01
SQL> select count(*)
2 from purchaseorder,
3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
5 /
COUNT(*)
33
1 row selected.
Elapsed: 00:00:00.01
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 3049344732
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 69 | 17 (6)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 69 | | |
| 2 | NESTED LOOPS | | 25 | 1725 | 17 (6)| 00:00:01 |
| 3 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
|* 5 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 39 | 1 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("SYS_NC00011$"='717951002372')
5 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-in
stance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-propert
ies/><read-contents/></privilege>''))=1)
6 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
24 rows selected.
Elapsed: 00:00:00.03
SQL> explain plan for
2 select extractValue(object_value,'/PurchaseOrder/Reference')
3 from purchaseorder,
4 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
5 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
6 /
Explained.
Elapsed: 00:00:00.06
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 1516269755
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 25 | 2450 | 28 (0)| 00:00:01 |
| 1 | NESTED LOOPS | | 25 | 2450 | 28 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
|* 3 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 68 | 1 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("SYS_NC00011$"='717951002372')
3 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
ties/><read-contents/></privilege>''))=1)
4 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
22 rows selected.
Elapsed: 00:00:00.04
SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
2 from purchaseorder,
3 table (xmlsequence(extract(object_value,'/PurchaseOrder/LineItems/LineItem'))) l
4 where existsNode(value(l),'/LineItem[Part/@Id="717951002372"]') = 1
5 /
EXTRACTVALUE(OBJECT_VALUE,'/PU
MWEISS-20030616154327385GMT
NSARCHAN-20030703170041824GMT
HBAER-20030206173836987GMT
LOZER-20031110131149107GMT
WTAYLOR-20030120174534374GMT
MHARTSTE-20031103172937613GMT
KGEE-20030919215826550GMT
PSULLY-20030712141634504GMT
JPATEL-20030630175356693GMT
RMATOS-2003072920455000GMT
DRAPHEAL-20030528180033254GMT
JRUSSEL-20031121213026539GMT
PTUCKER-20030918160532301GMT
SVOLLMAN-20031027120838903GMT
WGIETZ-20030208185026303GMT
TFOX-20030110164614994GMT
JPATEL-20030304214301386GMT
GGEONI-20030606135257846GMT
STOBIAS-20030817120358785GMT
COLSEN-20030525200717658GMT
SBAIDA-20030224182546606GMT
IMIKKILI-20030118180347537GMT
ABULL-20030429162730766GMT
NSARCHAN-20031113183134873GMT
LBISSOT-20030809134114505GMT
JKING-20030420162058859GMT
JMALLIN-20030506152048261GMT
AFRIPP-20030311153808601GMT
SHIGGINS-20030831151756257GMT
DBERNSTE-20030626122725631GMT
KPARTNER-20031021160248962GMT
ABANDA-2003062721524842GMT
DOCONNEL-20030904214708637GMT
33 rows selected.
Elapsed: 00:00:00.01
SQL> explain plan for
2 select extractValue(object_value,'/PurchaseOrder/Reference')
3 from purchaseorder
4 where existsNode
5 (
6 object_value,
7 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
8 ) = 1
9 /
Explained.
Elapsed: 00:00:00.03
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'))
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 1197255270
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 25 | 2450 | 17 (6)| 00:00:01 |
| 1 | NESTED LOOPS | | 25 | 2450 | 17 (6)| 00:00:01 |
| 2 | SORT UNIQUE | | 25 | 750 | 3 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | IPARTNUMBERINDEX | 25 | 750 | 3 (0)| 00:00:01 |
|* 4 | TABLE ACCESS BY INDEX ROWID| PURCHASEORDER | 1 | 68 | 1 (0)| 00:00:01 |
|* 5 | INDEX UNIQUE SCAN | LINEITEM_LIST | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
3 - access("SYS_NC00011$"='717951002372')
4 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype(''<privilege
xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
nstance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-proper
ties/><read-contents/></privilege>''))=1)
5 - access("NESTED_TABLE_ID"="PURCHASEORDER"."SYS_NC0003400035$")
23 rows selected.
Elapsed: 00:00:00.03
SQL> select extractValue(object_value,'/PurchaseOrder/Reference')
2 from purchaseorder
3 where existsNode
4 (
5 object_value,
6 '/PurchaseOrder/LineItems/LineItem/Part[@Id="717951002372"]'
7 ) = 1
8 /
EXTRACTVALUE(OBJECT_VALUE,'/PU
MWEISS-20030616154327385GMT
NSARCHAN-20030703170041824GMT
HBAER-20030206173836987GMT
LOZER-20031110131149107GMT
WTAYLOR-20030120174534374GMT
MHARTSTE-20031103172937613GMT
KGEE-20030919215826550GMT
PSULLY-20030712141634504GMT
JPATEL-20030630175356693GMT
RMATOS-2003072920455000GMT
DRAPHEAL-20030528180033254GMT
JRUSSEL-20031121213026539GMT
PTUCKER-20030918160532301GMT
SVOLLMAN-20031027120838903GMT
WGIETZ-20030208185026303GMT
TFOX-20030110164614994GMT
JPATEL-20030304214301386GMT
GGEONI-20030606135257846GMT
STOBIAS-20030817120358785GMT
COLSEN-20030525200717658GMT
SBAIDA-20030224182546606GMT
IMIKKILI-20030118180347537GMT
ABULL-20030429162730766GMT
NSARCHAN-20031113183134873GMT
LBISSOT-20030809134114505GMT
JKING-20030420162058859GMT
JMALLIN-20030506152048261GMT
AFRIPP-20030311153808601GMT
SHIGGINS-20030831151756257GMT
DBERNSTE-20030626122725631GMT
KPARTNER-20031021160248962GMT
ABANDA-2003062721524842GMT
DOCONNEL-20030904214708637GMT
33 rows selected.
Elapsed: 00:00:00.03
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options -
XQuery all docs in an XMLType column?
I created the following table:
create table security(sdoc XMLType)
I inserted xml files:
insert into security values (xmltype(?))
Now I want to query the xml docs using XQuery.
Is there a way to query all xml docs in a XMLType column with an XQuery expression at once?
Like:
for $i in function(sdoc)
where $i/Symbol = "ABCD"
return $i
Is there a function that returns an XML Sequence that consist of all docs in the XMLType column? Or do I have to adopt the query tuple by tuple?
I looked in the 10g Release 2 documentation and found the function XMLQuery, but my understanding was that the XMLQuery-function only takes one tuple (one doc). Is that right?
I'm using JDBC to connect to the database. Do you have a hint how I can use the XQuery inside XMLQuery in my case?
Thanks in advancethx for your help!! But I still have a problem.
I created an XMLType table:
create table security of xmltype
I inserted 10 xml docs:
insert into security values(xmltype(?))
The xml docs are like this:
<?xml version="1.0" encoding="US-ASCII"?>
<Security id="10000">
<Symbol>ATRK</Symbol>
<Name>@Track Communications, Inc.</Name>
<ShortName>ATRK</ShortName>
<SecurityType>Stock</SecurityType>
<SecurityInformation><StockInformation><Sector>Healthcare</Sector>
<Industry>Constr.-Supplies&Fixtures</Industry>
<Industry>BusinessServices</Industry>
<Industry>Auto&TruckManufacturers</Industry>
<Industry>FoodProcessing</Industry>
<Industry>OilWellServices&Equipment</Industry>
<Industry>Oil&Gas-Integrated</Industry>
<Category Capitalization="Large" Class="Blend"></Category>
<OutstShares>221841392</OutstShares>
</StockInformation>
<Description>
</Description>
</SecurityInformation>
<Price><LastTrade>91.5358</LastTrade>
<Ask>92.1646</Ask>
<Bid>91.2767</Bid>
<Price50DayAvg>105.3278</Price50DayAvg>
<Price200DayAvg>96.2106</Price200DayAvg>
<PriceToday><PreviousClose>91.5358</PreviousClose>
<Open>94.6341</Open>
<High>99.3516</High>
<Low>93.8742</Low>
</PriceToday>
<Price52week><Price52week-low>93.8742</Price52week-low>
<Price52week-low-date>2004-09-10</Price52week-low-date>
<Price52week-high>105.3278</Price52week-high>
<Price52week-high-date>2004-08-01</Price52week-high-date>
</Price52week>
</Price>
<PE>20.38</PE>
<Yield>6.95</Yield>
<DivPerShare>4.75</DivPerShare>
</Security>
But when I run the query:
Select xmlquery('for $i in ora:view("security")/Security/Symbol return $i' returning content).extract('/*') RESULT from security
I'm getting this:
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
<Symbol>TDSC</Symbol>
<Symbol>ATRK</Symbol>
<Symbol>OIIM</Symbol>
<Symbol>CTAC</Symbol>
<Symbol>FLWS</Symbol>
<Symbol>ATTY</Symbol>
<Symbol>FCCY</Symbol>
<Symbol>SRCE</Symbol>
<Symbol>TFSM</Symbol>
<Symbol>COMS</Symbol>
10 times the expected result. But it makes sense since I have 10 rows, I get the xquery result for each row. Is there way to get it only once??
I translated the xquery into sql using extract (extractValue):
Select extract(object_value, '/Security/Symbol')
From security
And I'm getting the expected result: only one time the above result. But I don't want to translate all of my xqueries.
thx in advance!! -
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
UK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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
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> -
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.
Maybe you are looking for
-
Weblogic realm authentication failure getting connection from pool
We are getting this error when we try to get a connection from the pool for a Tx Data Source. We are successfully getting connections from a (non-Tx) Data Source. java.lang.SecurityException: Authentication for user Fitness_demo denied in realm weblo
-
I am trying to install Windows on a new iMac w/3TB Fusion drive. The system crashed on my first attempt but appears to have partitioned the drive correctly before crashing??? So, what size partition does Windows 8 need to operate effectively? Is "m
-
Idoc to X12 file seeburger error
I get the below error at the receiver file adpter,tested the mapping internally and it works fine.Can you help me please.D_165 is mapped to a constant 'U'. SEEBURGER BICXIADAPTER --- CONVERSION ERROR ---InhouseDocReader doSyntaxCheck(): offset[281]:
-
My charger no longer fits in!
My iPad 3 charger no longer fits in correct, i need to push it in with force and a special way. There is no water or anything else in the charger or iPad. I tried two chargers both with the same result. I have been using this iPad and charger for ove
-
Last night I saved a project I've been working on for a couple of days. It's been fine all along. Today, when I went to open it, it's no longer listed in the recently opened files on startup and i get this message: "The project was saved in a newer v