Need help in updating an XML schema
747728Feb 7 2011 — edited Feb 13 2011Hi ALL,
Good Morning to all, i have problem in updating an XML schema. I have created a xml schema say "XMLSCHEMA1" based on this schema i have created a xmltype table and inserted a value to the table. And now i have to update the "XMLSCHEMA1" to "XMLSCHEMA2" without affecting the table and the data created by the "XMLSCHEMA1". Kindly help me to solve this. Here by i am posting all the workings i have done...
I am using the following client:
-----------------------------------
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 31 11:44:59 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
////////////////////////////////// XML Schema ///////////////////////
begin
dbms_xmlschema.registerSchema(
'http://www.oradev.com/chipsxml1.xsd',
'<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.oradev.com/chipsxml1.xsd"
xmlns:samp="http://www.oradev.com/chipsxml1.xsd"
version="1.0">
<element name="HICC">
<complexType>
<sequence>
<element name="UTI">
<complexType>
<sequence>
<element name = "U01" type = "string"/>
<element name = "U02" type = "string"/>
<element name = "U03" type = "string"/>
<element name = "U03a" type = "string"/>
<element name = "U03b" type = "string"/>
<element name = "U03c" type = "string"/>
<element name = "U04" type = "string"/>
<element name = "U05" type = "string"/>
</sequence>
</complexType>
</element>
<element name="SSI">
<complexType>
<sequence>
<element name = "S01" type = "string"/>
<element name = "S02" type = "string"/>
<element name = "S02A" type = "string"/>
<element name = "S02B" type = "string"/>
<element name = "S02C" type = "string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>',
TRUE, TRUE, FALSE, FALSE);
end;
////////////////////////// Table which has multiple Column //////////////////////////
CREATE TABLE chipsxmltable2 (
id number, HICCXMLDATA XmlType)
XMLTYPE HICCXMLDATA STORE AS OBJECT RELATIONAL
XMLSCHEMA "http://www.oradev.com/chipsxml1.xsd"
ELEMENT "HICC";
///////////////////////////////// Insert Query in chipsxmltable //////////////////////////
INSERT INTO chipsxmltable2 VALUES(1,
xmltype.createxml('<?xml version="1.0"?>
<samp:HICC xmlns:samp="http://www.oradev.com/chipsxml1.xsd" >
<UTI>
<U01>No</U01>
<U02>Y</U02>
<U03>Y</U03>
<U03a>Y</U03a>
<U03b>Y</U03b>
<U03c>Y</U03c>
<U04>Y</U04>
<U05>Y</U05>
</UTI>
<SSI>
<S01>No</S01>
<S02>Y</S02>
<S02A>Y</S02A>
<S02B>Y</S02B>
<S02C>Y</S02C>
</SSI>
</samp:HICC>'));
//////// This is my Revised XML Schema ///////////////////////
begin
dbms_xmlschema.registerSchema(
'http://www.oradev.com/Rchipsxml1.xsd',
'<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.oradev.com/Rchipsxml1.xsd"
xmlns:samp="http://www.oradev.com/Rchipsxml1.xsd"
version="1.0">
<element name="HICC">
<complexType>
<sequence>
<element name="UTI">
<complexType>
<sequence>
<element name = "U01" type = "string"/>
<element name = "U02" type = "string"/>
<element name = "U03" type = "string"/>
<element name = "U03a" type = "string"/>
<element name = "U03b" type = "string"/>
<element name = "U03c" type = "string"/>
<element name = "U04" type = "string"/>
<element name = "U05" type = "string"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>',
TRUE, TRUE, FALSE, FALSE);
end;
My question is:
----------------
How to update schema without affecting my table and the data which is already in the table?
When i try to update the schema,
////////////////////////// Updating Schema //////////////////////////
DECLARE
res BOOLEAN;
BEGIN
res := DBMS_XDB.createResource(
'http://www.oradev.com/Rchipsxml1.xsd',
bfilename('XMLDIR', 'http://www.oradev.comRchipsxml1.xsd'),
nls_charset_id('AL32UTF8'));
END;
I am getting this error:
--------------------------
DECLARE
*
ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
The system cannot find the file specified.
ORA-06512: at "SYS.DBMS_LOB", line 523
ORA-06512: at "XDB.DBMS_XDB", line 178
ORA-06512: at line 4
BEGIN
DBMS_XMLSCHEMA.copyEvolve(
xdb$STRUBG_LIST_T('http://www.oradev.com/chipsxml1.xsd'),
xmlSequenceType(XDBURIType('www.oradev.com/Rchipsxml1.xsd').getXML()));
END;
BEGIN
DBMS_XMLSCHEMA.copyEvolve(
xdb$string_list_t('http://www.oradev.com/chipsxml1.xsd'),
xmlSequenceType(XDBURIType('www.oradev.com/Rchipsxml1.xsd').getXML()));
END;
Apologies if the description is not clear. Kindly let me know if further details are needed. Many thanks for your help.
Very best regards,
Godwin Jebakumar C.V.