Dbms_xmlschema.registerschema
I can run dbms_xmlschema.registerschema fine as a standalone pl/sql block but as soon as I create a procedure to wrap around this procedure in a package,
I am getting following erross.
SQL> @test_regschema
Calling dbms_xmlschema.registerschema('http://sbcld.sbc.com/tea/tldapi.xsd',)
error at 510ORA-01031: insufficient privileges
Any ideas.
PRivlidges granted by roles are not granted in procedures. You'll need to grant all the privlidges associated with connect and resoure
Similar Messages
-
Hello,
I have some problems with dbms_xmlschema.registerschema
My database is: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
My XSD schema is (SEPA pain.002.001.03.xsd) also available on this url: http://code.google.com/p/leontestbed/source/browse/trunk/bc2/sample/Schema/pain.002.001.03.xsd?r=241
After
begin
DOK_XML_UTIL.p_vnesi_xsd_blob(401941242); -- store a XSD on file system from blob field
dbms_xmlschema.registerschema(
schemaurl => 'http://localhost/TEST1.XSD',
schemadoc => bfilename('ETAX_LOAD','TEST1.XSD'),
csid => nls_charset_id('AL32UTF8'));
commit;
end;I get:
ORA-31084: error while creating table "INIS_PROD"."Document2781_TAB" for element "Document"
ORA-02320: failure in creating storage table for nested table column "XMLDATA"."CstmrPmtStsRpt"."OrgnlPmtInfAndSts"
ORA-01792: maximum number of columns in a table or view is 1000
ORA-02310: exceeded maximum number of allowable columns in table
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 65
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 136
ORA-06512: at line 4
What I'am doing wrong or what is the reason for this error..Arrgghhh.....
begin
DOK_XML_UTIL.p_vnesi_xsd_blob(401941242);
dbms_xmlschema.registerschema(
schemaurl => 'http://localhost/TEST1.XSD',
schemadoc => bfilename('ETAX_LOAD','TEST1.XSD'),
csid => nls_charset_id('AL32UTF8')
, local => true
, genTypes => false
, genTables => false);
commit;
end;sorry... -
Using DBMS_XMLSCHEMA.registerSchema
Hi:
use DBMS_XMLSCHEMA.registerSchema procedure to register the XML Schema of invoiceformtest.xsd
But I got error
What I tried is
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'http://localhost.mylocalhost.com:8080/xdb/invoiceformtest.xsd',
SCHEMADOC => bfilename('XMLDIR','invoiceformtest.xsd'),
CSID => nls_charset_id('AL32UTF8'));
END;
where is my error?
Please help
sem1) What was the error you got?
2) What version of Oracle (4 digits)
3) Your question belongs in the {forum:id=34} forum, so search that forum for your error and if you don't find the answer, repost your question there with the additional details. -
DBMS_XMLSCHEMA.REGISTERSCHEMA' must be declared
Hi,
I'm new to Oracle XMLDB. I tried to register a schema but got this error:
DBMS_XMLSCHEMA.REGISTERSCHEMA' must be declared
I installed 9.2.0.4.0 patch just last week.
Please advise. Thank you!$ sqlplus scott/tiger
SQL*Plus: Release 9.2.0.6.0 - Production on Tue Sep 12 07:52:13 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
SQL> select 1 from all_users where username = 'XDB';
1
1
SQL> select 1 from all_users where username = 'FOO';
no rows selected
SQL>The script is on the server and has to run by someone with DBA privilige -
RegisterSchema or XML document problem
Hi,
I would like to import some XML documents from internet. The root element in document looks like that:
<Report xmlns:p1="http://www.w3.org/2001/XMLSchema-instance" xmlns="spds.ifr.009.PL" p1:schemaLocation="spds.ifr.009.PL http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL&rs%3aFormat=XML&rc%3aSchema=True" Name="spds.ifr.009.PL" REPORTNAME1="blablabla">
And root element in schema looks like that:
<xs:schema xmlns="spds.ifr.009.PL" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="spds.ifr.009.PL" xmlns:xdb="http://xmlns.oracle.com/xdb">
So, I have to register schema with URL from document:
http://inetsqlcg:82/ReportServer?%2fReportPublisher%2fspds.ifr.009.PL&rs%3aFormat=XML&rc%3aSchema=True
but when I'm trying to register with UTL_URL.ESCAPE I have ORA-31000 error.
I can register with UTL_URL.UNESCAPE then the SCHEMA_URL in USER_XML_SCHEMAS is:
http://inetsqlcg:82/ReportServer?/ReportPublisher/spds.ifr.009.PL&rs:Format=XML&rc:Schema=True
but when I'm loading document into XMLTable correlated with schema there is an error: ORA-19007
Any suggestion, please.
And thanks in advance.This question is best asked in the {forum:id=34} forum. Make sure to look over the FAQ first. When posting, include the dbms_xmlschema.registerschema commands you used and show any errors. Also include your Oracle version (4 digits). Also include enough of the schema to show the root node for the corresponding XML.
-
Register XML schema using dbms_xmlschema in Oracle 11g
I have a xsd file located at C:\temp\test.xsd
I need to register this schema to create a XMLType table for Object Relational XML Storage.
How do I register the schema for relational storage?
I do not seem to find any example on internet for registering the schema for relational storage.
Any help would be highly appreciated.Thanks for help. The table is created now. But it created a CLOB table whereas I want a relational table with rows and columns. Is it because the schema was registered with SCHEMADOC as bfilename? How do I get the relational storage?
BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL=> 'TESTDEPT.XSD',
SCHEMADOC=> bfilename('XML_DIR','TESTDEPT.XSD'),
LOCAL=> TRUE,
GENTYPES=> TRUE,
GENTABLES=> FALSE,
CSID=> nls_charset_id('AL32UTF8'));
END;
CREATE TABLE TESTDEPT OF XMLType
XMLTYPE store AS OBJECT RELATIONAL
XMLSCHEMA "TESTDEPT.XSD" ELEMENT "root";
desc TESTDEPT;
Name Null Type
SYS_NC_ROWINFO$ XMLTYPE()
SELECT dbms_metadata.get_ddl('TABLE','TESTDEPT') from dual;
DBMS_METADATA.GET_DDL('TABLE','TESTDEPT')
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(CLOB)
CREATE TABLE "DMUSER"."TESTDEPT" OF XMLTYPE
XMLSCHEMA "TESTDEPT.XSD" ELEMENT "root" ID 4090 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "USERS"
My database version:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production -
Hello,
My Oracle version is: 9.2.0.4.
I'm trying to register a simple xsd and i obtain an ORA-22814.
My command :
DBMS_XMLSchema.registerSchema(schemaurl => 'xxx.xsd',
schemadoc => sys.UriFactory.getUri('/public/xxx.xsd'),
genTables => false,
local => false);
Result :
ORA-22814: attribute or element value is larger than declared in type
Any help is greatly Appreciated.
Thank you
the file :
<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Turbo XML 2.3.0.100. Conforms to w3c http://www.w3.org/2001/XMLSchema-->
<xsd:schema targetNamespace="http://ns.hr-xml.org" xmlns="http://ns.hr-xml.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1_0 (Single Namespace Edition)">
<xsd:annotation>
<xsd:documentation>
"Copyright The HR-XML Consortium. All Rights Reserved. http://www.hr-xml.org"
Name: StaffingOrder.xsd
Version: 1_0 (Single Namespace Edition)
Status: Recommendation
Date this version: 2003-02-26
Purpose: Defines the StaffingOrder Schema
Author(s): SIDES Workgroup
Documentation: SIDES.pdf
2003-Aug-12: This specification remains unchanged from the 2003-Feb-26 release. The version number and "Single Namespace Edition" have been added to the title page of the documentation in order to delineate it from previous releases where the Consortium used multiple namespaces. In addition, the version attribute of the xsd:schema element now reflects this same version number.
Terms of license can be found in license.txt.
</xsd:documentation>
</xsd:annotation>
<xsd:include schemaLocation="CPO/EntityIdType.xsd"/>
<xsd:element name="StaffingShift" type="StaffingShiftType"/>
<xsd:complexType name="StaffingShiftType">
<xsd:sequence>
<xsd:element name="Id" type="EntityIdType"/>
<xsd:element name="Name" type="xsd:string" minOccurs="0"/>
<xsd:element name="Hours" type="xsd:decimal" minOccurs="0"/>
<xsd:element name="StartTime" type="LocalTimeNkNaType" minOccurs="0"/>
<xsd:element name="EndTime" type="LocalTimeNkNaType" minOccurs="0"/>
<xsd:element name="TypeHours" type="xsd:string" minOccurs="0"/>
<xsd:element name="Comment" type="xsd:string" minOccurs="0"/>
<xsd:element name="ExternalStaffingShiftSetId" type="EntityIdType" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="shiftPeriod">
<xsd:annotation>
<xsd:documentation> Numeric values conform to: ISO 8601 2nd Edition; ISO8601:2000(E); pub 2000-12-15, Data elements and interchange formats, Information interchange, Representation of dates and times, http://www.iso.ch/cate/d26780.html/
</xsd:documentation>
<xsd:documentation>1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, 7 = Sunday</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="monthly"/>
<xsd:enumeration value="weekly"/>
<xsd:enumeration value="daily"/>
<xsd:enumeration value="1"/>
<xsd:enumeration value="2"/>
<xsd:enumeration value="3"/>
<xsd:enumeration value="4"/>
<xsd:enumeration value="5"/>
<xsd:enumeration value="6"/>
<xsd:enumeration value="7"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:schema>dbre,
Have you validated the schema to ensure it is wellformed and valid?
I always use the following link.
http://apps.gotdotnet.com/xmltools/xsdvalidator/ -
No rows in user_nested_tables after registerSchema
Hi,
i have registered a schema and then i get no rows from table user_nested_tables. Does anybody have an idea?
Here is the code:
DECLARE
-- vSchemaUrl VARCHAR2(256) := 'http://llv15.gv.local:8082//home/FP/Source/xsd/ePassAntrag.xsd';
vSchemaUrl VARCHAR2(256) := '/home/FP/Source/xsd/ePassAntrag.xsd';
BEGIN
dbms_xmlSchema.deleteSchema(vSchemaUrl, 4);
COMMIT;
END;
DECLARE
vRes BOOLEAN;
vSchemaPath VARCHAR2(256) := '/home/FP/Source/xsd/ePassAntrag.xsd';
vXmlSchema XMLTYPE := xmlType(
'<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.llv.li" targetNamespace="http://www.llv.li" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="PassAntrag" type="tns:PassAntragTyp" xdb:defaultTable="FP_EPASS_PASS_ANTRAEGE"/>
<xs:complexType name="PassAntragTyp" xdb:SQLType="FP_EPASS_PASS_ANTRAEGE_T" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Antrag" type="tns:AntragTyp" xdb:SQLName="ANTRAG_TYP"/>
<xs:element name="Person" type="tns:PersonTyp" xdb:SQLName="PERSON_TYP"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AntragTyp" xdb:SQLType="FP_EPASS_ANTRAEGE_T" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="UUID" default="0" nillable="false" xdb:SQLName="UUID" xdb:SQLType="NUMBER">
<xs:annotation>
<xs:documentation>UUID 38-stellig</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="99999999999999999999999999999999999999"/>
<xs:totalDigits value="38" fixed="true"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DocTyp" default="PASS" nillable="false" xdb:SQLName="DOC_TYP">
<xs:annotation>
<xs:documentation>Typ des Dokuments</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="2" fixed="false"/>
<xs:maxLength value="4" fixed="false"/>
<xs:enumeration value="ID"/>
<xs:enumeration value="KOMB"/>
<xs:enumeration value="PASS"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Antragsgrund" default="ABL" nillable="false" xdb:SQLName="ANTRAGSGRUND">
<xs:annotation>
<xs:documentation>Grund des Antrags: Erstantrag(EAN), Ersatzantrag für abgelaufene und beschädigte Pässe(ABL), Verlustantrag(VER), Namensänderung(NAM)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="3" fixed="false"/>
<xs:maxLength value="3" fixed="false"/>
<xs:enumeration value="EAN"/>
<xs:enumeration value="ABL"/>
<xs:enumeration value="VER"/>
<xs:enumeration value="NAM"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AntragDatum" nillable="false" xdb:SQLName="ANTRAG_DATUM">
<xs:annotation>
<xs:documentation>Datum des Antrags im Format DD.MM.YYYY</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="10"/>
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AntragOrt" default="*" nillable="false" xdb:SQLName="ANTRAG_ORT">
<xs:annotation>
<xs:documentation>Ort des Antrags</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PersonTyp" xdb:SQLType="FP_EPASS_PERSONEN_T" xdb:maintainDOM="false">
<xs:sequence>
<xs:element name="Name" nillable="false" xdb:SQLName="NANE">
<xs:annotation>
<xs:documentation>Name der Person</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="512"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Vorname" nillable="false" xdb:SQLName="VORNAME">
<xs:annotation>
<xs:documentation>Vorname der Person</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="512"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Geburtsdatum" default="31.12.4712" nillable="false" xdb:SQLName="GEBURTSDATUM">
<xs:annotation>
<xs:documentation>Geburtsdatum der Person im Format DD.MM.YYYY</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="10"/>
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Geschlecht" default="M" nillable="false" xdb:SQLName="GESCHLECHT">
<xs:annotation>
<xs:documentation>Geschlecht der Person M | W</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
<xs:maxLength value="1"/>
<xs:enumeration value="M"/>
<xs:enumeration value="W"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Passtitel" nillable="false" xdb:SQLName="PASSTITEL">
<xs:annotation>
<xs:documentation>Passtitel der Person </xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Groesse" default="*" nillable="false" xdb:SQLName="GROESSE">
<xs:annotation>
<xs:documentation>Grösse der Person in cm, * bei Kindern</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" fixed="false"/>
<xs:maxLength value="3" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Strasse" default="*" nillable="false" xdb:SQLName="STRASSE">
<xs:annotation>
<xs:documentation>Amtliche Adresse der Person : Strasse</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" fixed="false"/>
<xs:maxLength value="60" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Hausnummer" default="*" nillable="false" xdb:SQLName="HAUSNUMMER">
<xs:annotation>
<xs:documentation>Amtliche Adresse der Person : Hausnummer</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" fixed="false"/>
<xs:maxLength value="10" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="PLZ" default="*" nillable="false" xdb:SQLName="PLZ">
<xs:annotation>
<xs:documentation>Amtliche Adresse der Person : PLZ</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" fixed="false"/>
<xs:maxLength value="12" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Ort" default="*" nillable="false" xdb:SQLName="ORT">
<xs:annotation>
<xs:documentation>Amtliche Adresse der Person : Ort</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" fixed="false"/>
<xs:maxLength value="60" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="LandIso316613" default="LIE" nillable="false" xdb:SQLName="LAND_ISO_3166_13">
<xs:annotation>
<xs:documentation>Amtliche Adresse der Person : Kurzzeichen ISO 3166 1 3 des Landes</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="3" fixed="false"/>
<xs:maxLength value="3" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Telefon" default="" nillable="false" xdb:SQLName="TELEFON">
<xs:annotation>
<xs:documentation>TelefonNr der Person für Erreichbarkeit zu Bürozeiten</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0" fixed="false"/>
<xs:maxLength value="30" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Email" default="" nillable="false" xdb:SQLName="EMAIL">
<xs:annotation>
<xs:documentation>Email Adresse der Person für Erreichbarkeit</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0" fixed="false"/>
<xs:maxLength value="255" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Versand" default="EDA" nillable="false" xdb:SQLName="VERSAND">
<xs:annotation>
<xs:documentation>Art des Pass-Versands</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="3" fixed="false"/>
<xs:maxLength value="3" fixed="false"/>
<xs:enumeration value="EDA"/>
<xs:enumeration value="WHG"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Lieferadresse" default="" nillable="false" xdb:SQLName="LIEFERADRESSE">
<xs:annotation>
<xs:documentation>Lieferadresse des Pass-Versands</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0" fixed="false"/>
<xs:maxLength value="512" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="BesKennz" default="" nillable="true" xdb:SQLName="BES_KENNZ">
<xs:annotation>
<xs:documentation>Besondere Kennzeichen der Person</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0" fixed="false"/>
<xs:maxLength value="200" fixed="false"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="NameVornameVater" default="" nillable="false" xdb:SQLName="NAME_VORNAME_VATER">
<xs:annotation>
<xs:documentation>Name und Vorname des Vaters</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="512"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="LedNameVornameMutter" default="" nillable="false" xdb:SQLName="LED_NAME_VORNAME_MUTTER">
<xs:annotation>
<xs:documentation>Lediger Name und Vorname der Mutter</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="512"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="NameVornameEhepartner" default="" nillable="false" xdb:SQLName="NAME_VORNAME_EHEPARTNER">
<xs:annotation>
<xs:documentation>Name und Vorname des Ehepartners</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="512"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="NameVornameVertreter" default="" nillable="true" xdb:SQLName="NAME_VORNAME_VERTRETER">
<xs:annotation>
<xs:documentation>Name und Vorname des gesetzlichen Vertreters</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="512"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="FotoID" nillable="true" xdb:SQLName="FOTO_ID" xdb:SQLType="CLOB">
<xs:annotation>
<xs:documentation>Foto der Person für die ID (ID: nicht optional; muss mit SafeID abgesprochen werden)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:element>
<xs:element name="FotoPass" nillable="true" xdb:SQLName="FOTO_PASS" xdb:SQLType="CLOB">
<xs:annotation>
<xs:documentation>Foto der Person für den Pass (PASS: nicht optional; muss mit SafeID abgesprochen werden)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:element>
<xs:element name="SignID" nillable="true" xdb:SQLName="SIGN_ID" xdb:SQLType="CLOB">
<xs:annotation>
<xs:documentation>Unterschrift der Person für die ID (ID: nicht optional; muss mit SafeID abgesprochen werden)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:element>
<xs:element name="SignPass" nillable="true" xdb:SQLName="SIGN_PASS" xdb:SQLType="CLOB">
<xs:annotation>
<xs:documentation>Unterschrift der Person für den Pass (PASS: nicht optional; muss mit SafeID abgesprochen werden)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:element>
<xs:element name="SignVertreter" nillable="true" xdb:SQLName="SIGN_VERTTRETER" xdb:SQLType="CLOB">
<xs:annotation>
<xs:documentation>Unterschrift des gestzlichen Vertreters</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:element>
<xs:element name="FpDG3" nillable="true" xdb:SQLName="FP_DG3" xdb:SQLType="CLOB">
<xs:annotation>
<xs:documentation>Fingerprint der Person [DG3] (KOMB und PASS: nicht optional)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:element>
<xs:element name="FpFinger1" nillable="true" xdb:SQLName="FP_FINGER1" xdb:SQLType="NUMBER">
<xs:annotation>
<xs:documentation>Fingerprint der Person [Finger1] (KOMB und PASS: nicht optional) 1=r.Daumen;2=r.Zeige;3=r.Mittel;4=r.Ring;(5=r.Klein); 6=l.Daumen;7=l.Zeige;8=l.Mittel;9=l.Ring;10=l.Klein;20=kein Finger</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="FpQualitaet1" nillable="true" xdb:SQLName="FP_QUALITAET1" xdb:SQLType="NUMBER">
<xs:annotation>
<xs:documentation>Fingerprint der Person [Qualität1] (KOMB und PASS: nicht optional)</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="FpCaptureDevice1" nillable="true" xdb:SQLName="FP_CAPTURE_DEVICE1" xdb:SQLType="VARCHAR2">
<xs:annotation>
<xs:documentation>Fingerprint der Person [CaptureDevice1]</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="200"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="FpWSQ1" nillable="true" xdb:SQLName="FP_WSQ1" xdb:SQLType="CLOB">
<xs:annotation>
<xs:documentation>Fingerprint der Person [WSQ1]</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:element>
<xs:element name="FpFinger2" nillable="true" xdb:SQLName="FP_FINGER2" xdb:SQLType="NUMBER">
<xs:annotation>
<xs:documentation>Fingerprint der Person [Finger2] (KOMB und PASS: nicht optional) 1=r.Daumen;2=r.Zeige;3=r.Mittel;4=r.Ring;(5=r.Klein); 6=l.Daumen;7=l.Zeige;8=l.Mittel;9=l.Ring;10=l.Klein;20=kein Finger</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="20"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="FpQualitaet2" nillable="true" xdb:SQLName="FP_QUALITAET2" xdb:SQLType="NUMBER">
<xs:annotation>
<xs:documentation>Fingerprint der Person [Qualität2]</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="FpCaptureDevice2" nillable="true" xdb:SQLName="FP_CAPTURE_DEVICE2" xdb:SQLType="VARCHAR2">
<xs:annotation>
<xs:documentation>Fingerprint der Person [CaptureDevice2]</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="200"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="FpWSQ2" nillable="true" xdb:SQLName="FP_WSQ2" xdb:SQLType="CLOB">
<xs:annotation>
<xs:documentation>Fingerprint der Person [WSQ2]</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:base64Binary"/>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
BEGIN
IF dbms_xdb.existsResource(vSchemaPath) THEN
dbms_xdb.deleteResource(vSchemaPath);
END IF;
vRes := dbms_xdb.createResource(vSchemaPath, vXmlSchema);
COMMIT;
END;
DECLARE
vSchemaPath VARCHAR2(256) := '/home/FP/Source/xsd/ePassAntrag.xsd';
vSchemaUrl VARCHAR2(256) := 'http://llv15.gv.local:8082//home/FP/Source/xsd/ePassAntrag.xsd';
BEGIN
dbms_xmlschema.registerSchema(vSchemaPath, xdbURIType(vSchemaPath).getClob(),
TRUE, TRUE, FALSE, FALSE);
COMMIT;
END;
select table_name
from user_nested_tables;Many thanks in advance.
Regards,
MartinGENTABLES is false ?
PROCEDURE REGISTERSCHEMA
Argument Name Type In/Out Default?
SCHEMAURL VARCHAR2 IN
SCHEMADOC CLOB IN
LOCAL BOOLEAN IN DEFAULT
GENTYPES BOOLEAN IN DEFAULT
GENBEAN BOOLEAN IN DEFAULT
GENTABLES BOOLEAN IN DEFAULT
FORCE BOOLEAN IN DEFAULT
OWNER VARCHAR2 IN DEFAULT
ENABLEHIERARCHY BINARY_INTEGER IN DEFAULT
OPTIONS BINARY_INTEGER IN DEFAULT
SCHEMAOID RAW IN DEFAULT
IMPORT_OPTIONS BINARY_INTEGER IN DEFAULTNested tables are related to the top level table. They will only be generated when the top level table is generated. THe top level table is only generated when GENTABLES is true, or when a table is created using a CREATE TABLE with an XMLSCHMA clause -
DBMS_XMLSCHEMA commands concurrent executing
Java class methods execute statements 'DBMS_XMLSCHEMA.registerSchema' and 'DBMS_XMLSCHEMA.deleteSchema' on Oracle 9i through JDBC using Jboss 4.0.0.
Several users may request these service simulaneously and the following happens: one or both actions fail; after that records not associated with any registered schema can be found in 'user_xml_schemas' table or node for a schema url exists in the tree (Oracle treat this as the schema is registered) but no correspondent records can be found in 'user_xml_tables' and sometimes in 'user_xml_schemas'; then we cannot register any schema until we stop server and start it again. The methods, which are responsible for DBMS_XMLSCHEMA statements executing, first look up data source by JNDI-name, then call getConnection() of DataSource instance, then try to execute DBMS_XMLSCHEMA statement, e.g."BEGIN DBMS_XMLSCHEMA.registerSchema('some_url', 'some_valid_xsd_as_String'); END;", then close connection.
How can I avoid the situation described above? Or can I somehow prohibit executing any DBMS_XMLSCHEMA commands until a job is done (by Oracle means)?Sofia,
One possibility:
If you write an Oracle procedure/package and store it in the database, you could call this procedure/package instead of the dbms_xmlschema package. Then test for other sessions active from the user account with a select from the v$session view where username = the username your using. If there is an active session you could terminate the incoming session. If no active session you could then call the dbms_xmlschema package from your package passing it the correct information and execute immediate the registerschema. -
How do you "unregister a schema". The following is being used to register and validate but it will not "reregister". getting the following error:
DECLARE
RECURSE BOOLEAN := TRUE;
ANNOTATE BOOLEAN := FALSE;
EMBEDCOLL BOOLEAN := TRUE;
XSD_TYPE XMLTYPE;
XSD_CLOB CLOB;
XML_CLOB CLOB;
XML_TYPE XMLTYPE;
valid_flag INTEGER;
p_out CLOB;
BEGIN
EXECUTE IMMEDIATE 'CREATE OR REPLACE DIRECTORY XML_DIR AS ''C:\XMLAPI_PRODUCE''';
XSD_TYPE := dbms_xmlschema.generateschema('SJS','XMLAPI_INCIDENT_TYPE','APIIncident',RECURSE,ANNOTATE,EMBEDCOLL);
XSD_CLOB := XSD_TYPE.getclobval;
dbms_xmlschema.registerSchema('http://www.oracle.com/best.xsd', XSD_CLOB);
sjs.file_util.write_clob(XSD_CLOB,'TEST.xml','C:\XMLAPI_PRODUCE');
DBMS_LOB.CREATETEMPORARY(xml_CLOB,TRUE,dbms_lob.CALL);
DBMS_LOB.OPEN(xml_CLOB, DBMS_LOB.LOB_READWRITE);
sjs.file_util.ReadClob(xml_CLOB,'XML_DIR','INC200306261138511.xml');
xml_type := XMLTYPE.createXML(xml_clob);
IF xml_type.isSchemaValid('http://www.oracle.com/best.xsd') = 1 THEN
DBMS_OUTPUT.PUT_LINE('Valid xml');
ELSE
DBMS_OUTPUT.PUT_LINE('NOT Valid xml');
END IF;
DBMS_LOB.CLOSE(xml_CLOB);
DBMS_LOB.FREETEMPORARY(xml_CLOB);
dbms_output.put_line(p_out);
END;
ERROR at line 1:
ORA-31085: schema "http://www.oracle.com/best.xsd" already registered
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
ORA-06512: at line 15Got it, Thanks, The following stil always produces Not valid for the xml. Do you know a way to get the info on why the xml is invalid?
Thanks
SET SERVEROUTPUT ON SIZE 1000000
DECLARE
RECURSE BOOLEAN := TRUE;
ANNOTATE BOOLEAN := FALSE;
EMBEDCOLL BOOLEAN := TRUE;
XSD_TYPE XMLTYPE;
XSD_CLOB CLOB;
XML_CLOB CLOB;
XML_TYPE XMLTYPE;
valid_flag INTEGER;
p_out CLOB;
BEGIN
EXECUTE IMMEDIATE 'CREATE OR REPLACE DIRECTORY XML_DIR AS ''C:\XMLAPI_PRODUCE''';
XSD_TYPE := dbms_xmlschema.generateschema('SJS','XMLAPI_INCIDENT_TYPE','APIIncident',RECURSE,ANNOTATE,EMBEDCOLL);
XSD_CLOB := XSD_TYPE.getclobval;
dbms_xmlschema.deleteSchema('http://www.oracle.com/best.xsd', dbms_xmlschema.DELETE_CASCADE);
dbms_xmlschema.registerSchema('http://www.oracle.com/best.xsd', XSD_CLOB);
sjs.file_util.write_clob(XSD_CLOB,'TEST.xml','C:\XMLAPI_PRODUCE');
DBMS_LOB.CREATETEMPORARY(xml_CLOB,TRUE,dbms_lob.CALL);
DBMS_LOB.OPEN(xml_CLOB, DBMS_LOB.LOB_READWRITE);
sjs.file_util.ReadClob(xml_CLOB,'XML_DIR','TEST.xml');
xml_type := XMLTYPE.createXML(xml_clob);
IF xml_type.isSchemaValid(XSD_CLOB) = 1 THEN
DBMS_OUTPUT.PUT_LINE('Valid xml');
ELSE
DBMS_OUTPUT.PUT_LINE('NOT Valid xml');
END IF;
DBMS_LOB.CLOSE(xml_CLOB);
DBMS_LOB.FREETEMPORARY(xml_CLOB);
dbms_output.put_line(p_out);
END; -
DBMS_XMLSCHEMA.CopyEvolve produces ORA-30945: Could not create mapping tabl
Hi,
I am trying to update a XML Schema concerning the documents relaties.xsd (the old one) and relaties_v2.xsd (the new one containing only a minor change).
The document relaties.xsd looks like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
version="1.0">
<xsd:element name="Relatie" xdb:defaultTable="">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Voornaam" type="xsd:string"/>
<xsd:element name="Achternaam" type="xsd:string"/>
<xsd:element name="Tussenvoegsel" type="xsd:string"/>
<xsd:element name="Geboortedatum" type="xsd:date"/>
<xsd:element name="Geslacht">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="M"/>
<xsd:enumeration value="V"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Sofinummer">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{9}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Straatnaam" type="xsd:string"/>
<xsd:element name="Huisnummer" type="xsd:string"/>
<xsd:element name="Woonplaats" type="xsd:string"/>
<!--xsd:element name="Postcode" type="xsd:string"/-->
<xsd:element name="Postcode">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{4} [A-Z]{2}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Zrn">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1000000"/>
<xsd:maxInclusive value="99999999999999"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Here are the steps I took.
DECLARE
res BOOLEAN;
BEGIN
res := DBMS_XDB.createResource('/xsd/relaties.xsd',
bfilename('XSDDIR', 'relaties.xsd')
END;
DECLARE
res BOOLEAN;
BEGIN
res := DBMS_XDB.createResource('/xsd/relaties_v2.xsd',
bfilename('XSDDIR', 'relaties_v2.xsd')
END;
BEGIN
DBMS_XMLSCHEMA.registerSchema(
'http://localhost:8080/xsd/relaties.xsd',
XDBURIType('/xsd/relaties.xsd').getClob(),
TRUE,
FALSE,
FALSE,
TRUE);
END;
CREATE
TABLE relatie_documenten OF XMLTYPE
XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
ELEMENT "Relatie"
CREATE OR REPLACE
TRIGGER upo_rdt_ai
AFTER INSERT ON relatie_documenten
FOR EACH ROW
DECLARE
doc XMLType;
BEGIN
doc := :new.SYS_NC_ROWINFO$;
XMLType.schemaValidate(doc);
END;
Then I inserted some xml documents into the table relatie_documenten. The XSD worked fine.
Then I executed the following statement:
BEGIN
DBMS_XMLSCHEMA.copyEvolve
( schemaURLs => xdb$string_list_t('http://localhost:8080/xsd/relaties.xsd')
, newSchemas => XMLSequenceType(XDBURIType('/xsd/relaties_v2.xsd').getXML())
, preserveOldDocs => TRUE
, mapTabName => 'RELATIE_DOCUMENTEN_TEMP'
, generateTables => FALSE
END;
This resulted in:
ERROR at line 1:
ORA-30945: Could not create mapping table 'RELATIE_DOCUMENTEN_TEMP'
ORA-00600: internal error code, arguments: [kqludp2], [0x66AB407C], [0], [],
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 113
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 210
ORA-06512: at line 2
I checked system priviliges as documented in XML DB Developers Guide, Chapter 8 XML Schema Evolution. No other users were connected. The mapping table RELATIE_DOCUMENTEN_TEMP nor any other object named RELATIE_DOCUMENTEN_TEMP did not exist.
Anyone an idea why I cannot create my mapping table ?
GregorWhich release / platform are you working with
With 10.2.0.2.1 on Widows I get
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
2 :schemaURL := 'http://localhost:8080/xsd/relaties.xsd';
3 :schemaPath := '/public/relaties.xsd';
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
5 xmlns:xdb="http://xmlns.oracle.com/xdb"
6 elementFormDefault="unqualified"
7 attributeFormDefault="unqualified"
8 version="1.0">
9 <xsd:element name="Relatie" xdb:defaultTable="">
10 <xsd:complexType>
11 <xsd:sequence>
12 <xsd:element name="Voornaam" type="xsd:string"/>
13 <xsd:element name="Achternaam" type="xsd:string"/>
14 <xsd:element name="Tussenvoegsel" type="xsd:string"/>
15 <xsd:element name="Geboortedatum" type="xsd:date"/>
16 <xsd:element name="Geslacht">
17 <xsd:simpleType>
18 <xsd:restriction base="xsd:string">
19 <xsd:enumeration value="M"/>
20 <xsd:enumeration value="V"/>
21 </xsd:restriction>
22 </xsd:simpleType>
23 </xsd:element>
24 <xsd:element name="Sofinummer">
25 <xsd:simpleType>
26 <xsd:restriction base="xsd:string">
27 <xsd:pattern value="\d{9}"/>
28 </xsd:restriction>
29 </xsd:simpleType>
30 </xsd:element>
31 <xsd:element name="Straatnaam" type="xsd:string"/>
32 <xsd:element name="Huisnummer" type="xsd:string"/>
33 <xsd:element name="Woonplaats" type="xsd:string"/>
34 <!--xsd:element name="Postcode" type="xsd:string"/-->
35 <xsd:element name="Postcode">
36 <xsd:simpleType>
37 <xsd:restriction base="xsd:string">
38 <xsd:pattern value="\d{4} [A-Z]{2}"/>
39 </xsd:restriction>
40 </xsd:simpleType>
41 </xsd:element>
42 <xsd:element name="Zrn">
43 <xsd:simpleType>
44 <xsd:restriction base="xsd:integer">
45 <xsd:minInclusive value="1000000"/>
46 <xsd:maxInclusive value="99999999999999"/>
47 </xsd:restriction>
48 </xsd:simpleType>
49 </xsd:element>
50 </xsd:sequence>
51 </xsd:complexType>
52 </xsd:element>
53 </xsd:schema>');
54 begin
55 if (dbms_xdb.existsResource(:schemaPath)) then
56 dbms_xdb.deleteResource(:schemaPath);
57 end if;
58 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
59 end;
60 /
PL/SQL procedure successfully completed.
SQL> BEGIN
2 DBMS_XMLSCHEMA.registerSchema(
3 :schemaURL,
4 XDBURIType(:schemaPath).getClob(),
5 TRUE,
6 FALSE,
7 FALSE,
8 TRUE);
9 END;
10 /
PL/SQL procedure successfully completed.
SQL> DROP TABLE relatie_documenten FORCE
2 /
Table dropped.
SQL> CREATE TABLE relatie_documenten OF XMLTYPE
2 XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
3 ELEMENT "Relatie"
4 /
Table created.
SQL> CREATE OR REPLACE TRIGGER upo_rdt_ai
2 AFTER INSERT ON relatie_documenten
3 FOR EACH ROW
4 DECLARE
5 doc XMLType;
6 BEGIN
7 doc := :new.SYS_NC_ROWINFO$;
8 XMLType.schemaValidate(doc);
9 END;
10 /
Trigger created.
SQL> INSERT
2 INTO relatie_documenten
3 VALUES (XMLType
4 ('<Relatie>
5 <Voornaam>Johan</Voornaam>
6 <Achternaam>Hermans</Achternaam>
7 <Tussenvoegsel/>
8 <Geboortedatum>1978-01-02</Geboortedatum>
9 <Geslacht>M</Geslacht>
10 <Sofinummer>233300417</Sofinummer>
11 <Straatnaam>Stationstraat</Straatnaam>
12 <Huisnummer>10</Huisnummer>
13 <Woonplaats>Weesp</Woonplaats>
14 <Postcode>1383 AK</Postcode>
15 <Zrn>1234567</Zrn>
16 </Relatie>'
17 ).CreateSchemaBasedXML(:schemaURL))
18 /
1 row created.
SQL> commit
2 /
Commit complete.
SQL> INSERT
2 INTO relatie_documenten
3 VALUES (XMLType
4 ('<Relatie>
5 <Voornaam>Johanna</Voornaam>
6 <Achternaam>Gurts</Achternaam>
7 <Tussenvoegsel/>
8 <Geboortedatum>1975-11-12</Geboortedatum>
9 <Geslacht>V</Geslacht>
10 <Sofinummer>234109807</Sofinummer>
11 <Straatnaam>Stationstraat</Straatnaam>
12 <Huisnummer>10</Huisnummer>
13 <Woonplaats>Weesp</Woonplaats>
14 <Postcode>1383 AK</Postcode>
15 <Zrn>7654321</Zrn>
16 </Relatie>').CreateSchemaBasedXML(:schemaURL))
17 /
1 row created.
SQL> commit
2 /
Commit complete.
SQL> INSERT
2 INTO relatie_documenten
3 VALUES (XMLType
4 ('<Relatie>
5 <Voornaam>Johanna</Voornaam>
6 <Achternaam>Gurts</Achternaam>
7 <Tussenvoegsel/>
8 <Geboortedatum>1975-11-12</Geboortedatum>
9 <Geslacht>O</Geslacht>
10 <Sofinummer>234109807</Sofinummer>
11 <Straatnaam>Stationstraat</Straatnaam>
12 <Huisnummer>10</Huisnummer>
13 <Woonplaats>Weesp</Woonplaats>
14 <Postcode>1383 AK</Postcode>
15 <Zrn>7654321</Zrn>
16 </Relatie>').CreateSchemaBasedXML(:schemaURL))
17 /
VALUES (XMLType
ERROR at line 3:
ORA-31038: Invalid enumeration value: "O"
ORA-06512: at "SYS.XMLTYPE", line 345
ORA-06512: at "SCOTT.UPO_RDT_AI", line 5
ORA-04088: error during execution of trigger 'SCOTT.UPO_RDT_AI'
SQL> commit
2 /
Commit complete.
SQL> declare
2 xmlschema xmltype;
3 res boolean;
4 begin
5 select xdburitype(:schemaPath).getXML()
6 into xmlSchema
7 from dual;
8 dbms_xdb.deleteResource(:schemaPath);
9 select insertChildXML
10 (
11 xmlschema,
12 '/xsd:schema//xsd:element[@name="Geslacht"]/xsd:simpleType/xsd:restriction',
13 'xsd:enumeration',
14 xmltype('<xsd:enumeration xmlns:xsd="http://www.w3.org/2001/XMLSchema" value="O"/>'),
15 'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
16 )
17 into xmlSchema
18 from dual;
19 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
20 end;
21 /
PL/SQL procedure successfully completed.
SQL> commit
2 /
Commit complete.
SQL> set long 100000 pages 200 lines 140
SQL> --
SQL> select xdburitype(:schemaPath).getXML()
2 from dual
3 /
XDBURITYPE(:SCHEMAPATH).GETXML()
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="unqualified" attributeF
ormDefault="unqualified" version="1.0">
<xsd:element name="Relatie" xdb:defaultTable="">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Voornaam" type="xsd:string"/>
<xsd:element name="Achternaam" type="xsd:string"/>
<xsd:element name="Tussenvoegsel" type="xsd:string"/>
<xsd:element name="Geboortedatum" type="xsd:date"/>
<xsd:element name="Geslacht">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="M"/>
<xsd:enumeration value="V"/>
<xsd:enumeration xmlns:xsd="http://www.w3.org/2001/XMLSchema" value="O"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Sofinummer">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{9}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Straatnaam" type="xsd:string"/>
<xsd:element name="Huisnummer" type="xsd:string"/>
<xsd:element name="Woonplaats" type="xsd:string"/>
<!--xsd:element name="Postcode" type="xsd:string"/-->
<xsd:element name="Postcode">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{4} [A-Z]{2}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Zrn">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1000000"/>
<xsd:maxInclusive value="99999999999999"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
SQL> DROP TABLE RELATIE_DOCUMENTEN_TEMP
2 /
Table dropped.
SQL> BEGIN
2 DBMS_XMLSCHEMA.copyEvolve
3 ( schemaURLs => xdb$string_list_t(:schemaURL)
4 , newSchemas => XMLSequenceType(XDBURIType(:schemaPath).getXML())
5 , preserveOldDocs => TRUE
6 , mapTabName => 'RELATIE_DOCUMENTEN_TEMP'
7 , generateTables => FALSE
8 );
9 END;
10 /
PL/SQL procedure successfully completed.
SQL> CREATE TABLE relatie_documenten OF XMLTYPE
2 XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
3 ELEMENT "Relatie"
4 /
Table created.
SQL> CREATE OR REPLACE TRIGGER upo_rdt_ai
2 AFTER INSERT ON relatie_documenten
3 FOR EACH ROW
4 DECLARE
5 doc XMLType;
6 BEGIN
7 doc := :new.SYS_NC_ROWINFO$;
8 XMLType.schemaValidate(doc);
9 END;
10 /
Trigger created.
SQL> declare
2 tablename varchar2(2000);
3 begin
4 select temp_tabname
5 into tablename
6 from RELATIE_DOCUMENTEN_TEMP
7 where table_name = USER || '.' || upper('relatie_documenten');
8 execute immediate 'insert into relatie_documenten select xmltype(data) from ' || tablename;
9 commit;
10 end;
11 /
PL/SQL procedure successfully completed.
SQL> select *
2 from relatie_documenten
3 /
SYS_NC_ROWINFO$
<Relatie>
<Voornaam>Johan</Voornaam>
<Achternaam>Hermans</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1978-01-02</Geboortedatum>
<Geslacht>M</Geslacht>
<Sofinummer>233300417</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>1234567</Zrn>
</Relatie>
<Relatie>
<Voornaam>Johanna</Voornaam>
<Achternaam>Gurts</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1975-11-12</Geboortedatum>
<Geslacht>V</Geslacht>
<Sofinummer>234109807</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>7654321</Zrn>
</Relatie>
SQL> INSERT
2 INTO relatie_documenten
3 VALUES (XMLType
4 ('<Relatie>
5 <Voornaam>Johanna</Voornaam>
6 <Achternaam>Gurts</Achternaam>
7 <Tussenvoegsel/>
8 <Geboortedatum>1975-11-12</Geboortedatum>
9 <Geslacht>O</Geslacht>
10 <Sofinummer>234109807</Sofinummer>
11 <Straatnaam>Stationstraat</Straatnaam>
12 <Huisnummer>10</Huisnummer>
13 <Woonplaats>Weesp</Woonplaats>
14 <Postcode>1383 AK</Postcode>
15 <Zrn>7654321</Zrn>
16 </Relatie>').CreateSchemaBasedXML(:schemaURL))
17 /
1 row created.
SQL> commit
2 /
Commit complete.
SQL> select *
2 from relatie_documenten
3 /
SYS_NC_ROWINFO$
<Relatie>
<Voornaam>Johan</Voornaam>
<Achternaam>Hermans</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1978-01-02</Geboortedatum>
<Geslacht>M</Geslacht>
<Sofinummer>233300417</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>1234567</Zrn>
</Relatie>
<Relatie>
<Voornaam>Johanna</Voornaam>
<Achternaam>Gurts</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1975-11-12</Geboortedatum>
<Geslacht>V</Geslacht>
<Sofinummer>234109807</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>7654321</Zrn>
</Relatie>
<Relatie>
<Voornaam>Johanna</Voornaam>
<Achternaam>Gurts</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1975-11-12</Geboortedatum>
<Geslacht>O</Geslacht>
<Sofinummer>234109807</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>7654321</Zrn>
</Relatie>
SQL>Here's the SQL, can you cut'n'paste and run the whole thing as XML_OWNER
var schemaURL varchar2(256)
var schemaPath varchar2(256)
begin
:schemaURL := 'http://localhost:8080/xsd/relaties.xsd';
:schemaPath := '/public/relaties.xsd';
end;
call dbms_xmlSchema.deleteSchema(:schemaURL,4)
declare
res boolean;
xmlSchema xmlType := xmlType(
'<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
version="1.0">
<xsd:element name="Relatie" xdb:defaultTable="">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Voornaam" type="xsd:string"/>
<xsd:element name="Achternaam" type="xsd:string"/>
<xsd:element name="Tussenvoegsel" type="xsd:string"/>
<xsd:element name="Geboortedatum" type="xsd:date"/>
<xsd:element name="Geslacht">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="M"/>
<xsd:enumeration value="V"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Sofinummer">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{9}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Straatnaam" type="xsd:string"/>
<xsd:element name="Huisnummer" type="xsd:string"/>
<xsd:element name="Woonplaats" type="xsd:string"/>
<!--xsd:element name="Postcode" type="xsd:string"/-->
<xsd:element name="Postcode">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{4} [A-Z]{2}"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Zrn">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1000000"/>
<xsd:maxInclusive value="99999999999999"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>');
begin
if (dbms_xdb.existsResource(:schemaPath)) then
dbms_xdb.deleteResource(:schemaPath);
end if;
res := dbms_xdb.createResource(:schemaPath,xmlSchema);
end;
BEGIN
DBMS_XMLSCHEMA.registerSchema(
:schemaURL,
XDBURIType(:schemaPath).getClob(),
TRUE,
FALSE,
FALSE,
TRUE);
END;
DROP TABLE relatie_documenten FORCE
CREATE TABLE relatie_documenten OF XMLTYPE
XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
ELEMENT "Relatie"
CREATE OR REPLACE TRIGGER upo_rdt_ai
AFTER INSERT ON relatie_documenten
FOR EACH ROW
DECLARE
doc XMLType;
BEGIN
doc := :new.SYS_NC_ROWINFO$;
XMLType.schemaValidate(doc);
END;
INSERT
INTO relatie_documenten
VALUES (XMLType
('<Relatie>
<Voornaam>Johan</Voornaam>
<Achternaam>Hermans</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1978-01-02</Geboortedatum>
<Geslacht>M</Geslacht>
<Sofinummer>233300417</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>1234567</Zrn>
</Relatie>'
).CreateSchemaBasedXML(:schemaURL))
commit
INSERT
INTO relatie_documenten
VALUES (XMLType
('<Relatie>
<Voornaam>Johanna</Voornaam>
<Achternaam>Gurts</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1975-11-12</Geboortedatum>
<Geslacht>V</Geslacht>
<Sofinummer>234109807</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>7654321</Zrn>
</Relatie>').CreateSchemaBasedXML(:schemaURL))
commit
INSERT
INTO relatie_documenten
VALUES (XMLType
('<Relatie>
<Voornaam>Johanna</Voornaam>
<Achternaam>Gurts</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1975-11-12</Geboortedatum>
<Geslacht>O</Geslacht>
<Sofinummer>234109807</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>7654321</Zrn>
</Relatie>').CreateSchemaBasedXML(:schemaURL))
commit
declare
xmlschema xmltype;
res boolean;
begin
select xdburitype(:schemaPath).getXML()
into xmlSchema
from dual;
dbms_xdb.deleteResource(:schemaPath);
select insertChildXML
xmlschema,
'/xsd:schema//xsd:element[@name="Geslacht"]/xsd:simpleType/xsd:restriction',
'xsd:enumeration',
xmltype('<xsd:enumeration xmlns:xsd="http://www.w3.org/2001/XMLSchema" value="O"/>'),
'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
into xmlSchema
from dual;
res := dbms_xdb.createResource(:schemaPath,xmlSchema);
end;
commit
set long 100000 pages 200 lines 140
select xdburitype(:schemaPath).getXML()
from dual
DROP TABLE RELATIE_DOCUMENTEN_TEMP
BEGIN
DBMS_XMLSCHEMA.copyEvolve
( schemaURLs => xdb$string_list_t(:schemaURL)
, newSchemas => XMLSequenceType(XDBURIType(:schemaPath).getXML())
, preserveOldDocs => TRUE
, mapTabName => 'RELATIE_DOCUMENTEN_TEMP'
, generateTables => FALSE
END;
CREATE TABLE relatie_documenten OF XMLTYPE
XMLSCHEMA "http://localhost:8080/xsd/relaties.xsd"
ELEMENT "Relatie"
CREATE OR REPLACE TRIGGER upo_rdt_ai
AFTER INSERT ON relatie_documenten
FOR EACH ROW
DECLARE
doc XMLType;
BEGIN
doc := :new.SYS_NC_ROWINFO$;
XMLType.schemaValidate(doc);
END;
declare
tablename varchar2(2000);
begin
select temp_tabname
into tablename
from RELATIE_DOCUMENTEN_TEMP
where table_name = USER || '.' || upper('relatie_documenten');
execute immediate 'insert into relatie_documenten select xmltype(data) from ' || tablename;
commit;
end;
select *
from relatie_documenten
INSERT
INTO relatie_documenten
VALUES (XMLType
('<Relatie>
<Voornaam>Johanna</Voornaam>
<Achternaam>Gurts</Achternaam>
<Tussenvoegsel/>
<Geboortedatum>1975-11-12</Geboortedatum>
<Geslacht>O</Geslacht>
<Sofinummer>234109807</Sofinummer>
<Straatnaam>Stationstraat</Straatnaam>
<Huisnummer>10</Huisnummer>
<Woonplaats>Weesp</Woonplaats>
<Postcode>1383 AK</Postcode>
<Zrn>7654321</Zrn>
</Relatie>').CreateSchemaBasedXML(:schemaURL))
commit
select *
from relatie_documenten
/ -
About dbms_xmlschema.delete_cascade_force
with oracle 10g.
1. exec dbms_xmlschema.registerschema('http://someurl', bfilename('SOMEFOLDER','some.xsd'));
2. create table TTT (key_col varchar2(10) primary key, xml_col xmltype)
xmltype column xml_col xmlschema "http://someurl" element "Fields"
3. insert into TTT values('001', xmltype(bfilename('SOMEFOLDER', 'data01.xml'), nls_charset_id('AL32UTF8')));
4. exec dbms_xmlschema.deleteschema('http://someurl', dbms_xmlschema.delete_cascade_force);
after step 4,
desc TTT will got ORA-24372
select count(*) from TTT will got ORA-04063
Could anyone tell me how to resolve this problem with no loss of TTT's data?No..
This one falls into the cateogory of "If it hurts please don't do it"
DELETE_CASCADE_FORCE should only be used when you are sure that you do not care for the content of any tables or columns that are based on the XML schema.. Please don't tell me you've done this in a a production system and now you need the data, because "There is no way to recover this data" except from a backup of the database before the schema was deleted...
Basically once the XML Schema has gone we have no way to correcly interpret the contents of the tables that contain the content of the documents.
-M -
Registerschema gives ORA-01792: maximum number of columns...
Hi,
DB: Oracle9i Enterprise Edition Release 9.2.0.6.0
Opp Sys: HP-UX
I've just increased the size of an XSD we have loaded in a customers database and attempting to reload using dbms_xmlschema.registerschema gives the following error:
ORA-31084: error while creating table "SOLO"."LetterRoot5799_TAB" for element "LetterRoot"
ORA-01792: maximum number of columns in a table or view is 1000
ORA-02310: exceeded maximum number of allowable columns in table
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
ORA-06512: at "SOLO.WORK_TEST_LETTERS_XSD", line 23
ORA-06512: at line 2
Is there a work around for this?
Thanks,
Mike MooreHi! I faced the same problem as author of a thread. At first it was just the same and I used solution that was offered - add attribute xdb:SQLInline="false".
But now this error (ORA-01792: maximum number of columns in a table or view is 1000) became to rise on element that doesn't have a lot of attributes or subelements that coul exceed limit of 1000! Moreover it is based on complex type that already exists! It was created during another schema registration, which is included in schema that I'm trying to register now!
Does anyone challenged this problem?
I use Oracle9i Enterprise Edition Release 9.2.0.5.0 -
ExtractValue not returning the data after dbms_xmlschema.CopyEvolve
Hi ,
I am facing the problem while selecting the value from the XMLTYPE table using extractValue.
Here address field is newly added to schema and evolved . But unable to get the address field value .
My procedures are like this
SQL> declare
2 res boolean;
3 xmlschema xmltype := xmltype(
4 '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
5 <xsd:complexType name="t_person" xdb:SQLType="PERSONDT_T">
6 <xsd:sequence>
7 <xsd:element name="persondetails" type="persondetailsType"/>
8 <xsd:element name="companyinfo" type="companyinfoType"/>
9 <xsd:element name="salaryinfo" type="salaryinfoType"/>
10 </xsd:sequence>
11 </xsd:complexType>
12 <xsd:complexType name="persondetailsType" xdb:SQLType="PERSONDETAILS_T">
13 <xsd:sequence>
14 <xsd:element name="personname" type="xsd:string" />
15 <xsd:element name="personexperience" type="xsd:decimal" />
16 </xsd:sequence>
17 </xsd:complexType>
18 <xsd:complexType name="companyinfoType" xdb:SQLType="COMPANYINFO_T">
19 <xsd:sequence>
20 <xsd:element name="companystartdate" type="xsd:date" />
21 <xsd:element name="companystandard" type="xsd:decimal" />
22 </xsd:sequence>
23 </xsd:complexType>
24 <xsd:complexType name="salaryinfoType" xdb:SQLType="SALARYINFO_T">
25 <xsd:sequence>
26 <xsd:element name="salary" type="xsd:decimal" />
27 <xsd:element name="paymonth" type="xsd:string" />
28 </xsd:sequence>
29 </xsd:complexType>
30 <xsd:element name="person" type="t_person" />
31 </xsd:schema>');
32 begin
33 if (dbms_xdb.existsResource('/public/personDetails.xsd')) then
34 dbms_xdb.deleteResource('/public/personDetails.xsd');
35 end if;
36 res := dbms_xdb.createResource('/public/personDetails.xsd',xmlschema);
37 end;
38 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema ('www.PersonInfoUrl.com',xdburitype('/public/personDetails.xsd'),TRUE,TRUE,FALSE,TRUE);
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> CREATE TABLE PERSON_COMP_TABLE
2 (empId VARCHAR2(100) CONSTRAINT pk_PERSONCOMP PRIMARY KEY
3 ,comments VARCHAR2(20)
4 ,joindate DATE
5 ,personjoininfo xmltype)
6 XMLTYPE COLUMN personjoininfo XMLSCHEMA "www.PersonInfoUrl.com" element "person"
7 /
Table created.
SQL> insert into PERSON_COMP_TABLE (empId ,comments ,joindate ,personjoininfo )
2 values ('2006NEW312','RDDEPT','15-jan-2006',
3 sys.XMLType.createXML(
4 '<?xml version="1.0" encoding="UTF-8"?>
5 <person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="www.PersonInfoUrl.com">
6 <persondetails>
7 <personname>Robert </personname>
8 <personexperience>4.5</personexperience>
9 </persondetails>
10 <companyinfo>
11 <companystartdate>2004-07-24</companystartdate>
12 <companystandard>3.9</companystandard>
13 </companyinfo>
14 <salaryinfo>
15 <salary>2444.3</salary>
16 <paymonth> june </paymonth>
17 </salaryinfo>
18 </person>'))
19 /
1 row created.
SQL> select count(*) from PERSON_COMP_TABLE;
COUNT(*)
1
SQL> declare
xmlschema xmltype := xdburitype('/public/personDetails.xsd').getXML();
res boolean;
begin
select insertChildXML(
xmlschema,
'/xsd:schema/xsd:complexType[@name="companyinfo"]/xsd:sequence',
'xsd:element',
xmltype('<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="address" type="xsd:string"
'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
into xmlSchema
from dual;
if (dbms_xdb.existsResource('/public/personDetails.xsd')) then
dbms_xdb.deleteResource('/public/personDetails.xsd');
end if;
res := dbms_xdb.createResource('/public/newpersonDetails.xsd',xmlschema);
end;
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.74
SQL> commit;
Commit complete.
Elapsed: 00:00:00.56
SQL> begin
dbms_xmlschema.CopyEvolve
xdb$string_list_t('www.PersonInfoUrl.com'),
XMLSequenceType(xdburitype('/public/newpersonDetails.xsd').getXML()),
null
end;
PL/SQL procedure successfully completed.
Elapsed: 00:00:08.49
SQL> commit;
Commit complete.
Elapsed: 00:00:00.52
SQL> select count(*) from PERSON_COMP_TABLE;
COUNT(*)
1
SQL> insert into PERSON_COMP_TABLE (empId ,comments ,joindate ,personjoininfo )
values ('1234PTR','DTSDDEPT','12-jan-2006',
sys.XMLType.createXML(
'<?xml version="1.0" encoding="UTF-8"?>
<person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="www.PersonInfoUrl.com">
<persondetails>
<personname>Julie </personname>
<personexperience>3.5</personexperience>
</persondetails>
<companyinfo>
<companystartdate>2005-11-21</companystartdate>
<companystandard>3.9</companystandard>
<address>santaclara</address>
</companyinfo>
<salaryinfo>
<salary>2444.3</salary>
<paymonth> june </paymonth>
</salaryinfo>
</person>'))
1 row created.
SQL> select count(*) from PERSON_COMP_TABLE;
COUNT(*)
2
SQL> SELECT empid, extractValue(personjoininfo,'/person/companyinfo/address') FROM PERSON_COMP_TABLE
2 /
empid
E
1234PTR
Here "address " is not returned. it has return the value "santaclara".
How to solve this ?. Please advise
Thanks
GovindaAfter chasing down couple of silly mistakes I was able to get your example to work
SQL> call dbms_xmlschema.deleteSchema ('www.PersonInfoUrl.com',4)
2 /
Call completed.
SQL> declare
2 res boolean;
3 xmlschema xmltype := xmltype(
4 '<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
5 <xsd:complexType name="t_person" xdb:SQLType="PERSONDT_T">
6 <xsd:sequence>
7 <xsd:element name="persondetails" type="persondetailsType"/>
8 <xsd:element name="companyinfo" type="companyinfoType"/>
9 <xsd:element name="salaryinfo" type="salaryinfoType"/>
10 </xsd:sequence>
11 </xsd:complexType>
12 <xsd:complexType name="persondetailsType" xdb:SQLType="PERSONDETAILS_T">
13 <xsd:sequence>
14 <xsd:element name="personname" type="xsd:string"/>
15 <xsd:element name="personexperience" type="xsd:decimal"/>
16 </xsd:sequence>
17 </xsd:complexType>
18 <xsd:complexType name="companyinfoType" xdb:SQLType="COMPANYINFO_T">
19 <xsd:sequence>
20 <xsd:element name="companystartdate" type="xsd:date"/>
21 <xsd:element name="companystandard" type="xsd:decimal"/>
22 </xsd:sequence>
23 </xsd:complexType>
24 <xsd:complexType name="salaryinfoType" xdb:SQLType="SALARYINFO_T">
25 <xsd:sequence>
26 <xsd:element name="salary" type="xsd:decimal"/>
27 <xsd:element name="paymonth" type="xsd:string"/>
28 </xsd:sequence>
29 </xsd:complexType>
30 <xsd:element name="person" type="t_person"/>
31 </xsd:schema>');
32 begin
33 if (dbms_xdb.existsResource('/public/personDetails.xsd')) then
34 dbms_xdb.deleteResource('/public/personDetails.xsd');
35 end if;
36 res := dbms_xdb.createResource('/public/personDetails.xsd',xmlschema);
37 end;
38 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_xmlschema.registerSchema ('www.PersonInfoUrl.com',xdburitype('/public/personDetails.xsd'),TRUE,TRUE,FALSE,TRUE);
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> DROP TABLE PERSON_COMP_TABLE
2 /
Table dropped.
SQL> CREATE TABLE PERSON_COMP_TABLE
2 (
3 empId VARCHAR2(100) CONSTRAINT pk_PERSONCOMP PRIMARY KEY
4 ,comments VARCHAR2(20)
5 ,joindate DATE
6 ,personjoininfo xmltype
7 )
8 XMLTYPE COLUMN personjoininfo XMLSCHEMA "www.PersonInfoUrl.com" element "person"
9 /
Table created.
SQL> insert into PERSON_COMP_TABLE (empId ,comments ,joindate ,personjoininfo )
2 values ('2006NEW312','RDDEPT','15-jan-2006',
3 XMLType(
4 '<?xml version="1.0" encoding="UTF-8"?>
5 <person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="www.PersonInfoUrl.com">
6 <persondetails>
7 <personname>Robert </personname>
8 <personexperience>4.5</personexperience>
9 </persondetails>
10 <companyinfo>
11 <companystartdate>2004-07-24</companystartdate>
12 <companystandard>3.9</companystandard>
13 </companyinfo>
14 <salaryinfo>
15 <salary>2444.3</salary>
16 <paymonth> june </paymonth>
17 </salaryinfo>
18 </person>'))
19 /
1 row created.
SQL> select count(*) from PERSON_COMP_TABLE
2 /
COUNT(*)
1
SQL> declare
2 xmlschema xmltype := xdburitype('/public/personDetails.xsd').getXML();
3 res boolean;
4 begin
5 select insertChildXML
6 (
7 xmlschema,
8 '/xsd:schema/xsd:complexType[@name="companyinfoType"]/xsd:sequence',
9 'xsd:element',
10 xmltype('<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="address" type="xsd:string"/>'),
11 'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
12 )
13 into xmlSchema
14 from dual;
15
16 if (dbms_xdb.existsResource('/public/newPersonDetails.xsd')) then
17 dbms_xdb.deleteResource('/public/newPersonDetails.xsd');
18 end if;
19
20 res := dbms_xdb.createResource('/public/newPersonDetails.xsd',xmlschema);
21 end;
22 /
PL/SQL procedure successfully completed.
SQL> commit
2 /
Commit complete.
SQL> begin
2 dbms_xmlschema.CopyEvolve
3 (
4 xdb$string_list_t('www.PersonInfoUrl.com'),
5 XMLSequenceType(xdburitype('/public/newPersonDetails.xsd').getXML()),
6 null
7 );
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> select count(*) from PERSON_COMP_TABLE
2 /
COUNT(*)
1
SQL> insert into PERSON_COMP_TABLE (empId ,comments ,joindate ,personjoininfo )
2 values ('1234PTR','DTSDDEPT','12-jan-2006',
3 XMLType(
4 '<?xml version="1.0" encoding="UTF-8"?>
5 <person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="www.PersonInfoUrl.com">
6 <persondetails>
7 <personname>Julie </personname>
8 <personexperience>3.5</personexperience>
9 </persondetails>
10 <companyinfo>
11 <companystartdate>2005-11-21</companystartdate>
12 <companystandard>3.9</companystandard>
13 <address>santaclara</address>
14 </companyinfo>
15 <salaryinfo>
16 <salary>2444.3</salary>
17 <paymonth> june </paymonth>
18 </salaryinfo>
19 </person>'))
20 /
1 row created.
SQL> commit
2 /
Commit complete.
SQL> select count(*) from PERSON_COMP_TABLE
2 /
COUNT(*)
2
SQL> SELECT empid, extractValue(personjoininfo,'/person/companyinfo/address') FROM PERSON_COMP_TABLE
2 /
EMPID
EXTRACTVALUE(PERSONJOININFO,'/PERSON/COMPANYINFO/ADDRESS')
2006NEW312
1234PTR
santaclara
SQL>The mistakes included the XPath used to insert the new element into the XML Schema
You had
'/xsd:schema/xsd:complexType[@name="companyinfo"]/xsd:sequence',
where as the correct XPath is
'/xsd:schema/xsd:complexType[@name="companyinfoType"]/xsd:sequence',
and then you had
if (dbms_xdb.existsResource('/public/personDetails.xsd')) then
dbms_xdb.deleteResource('/public/personDetails.xsd');
end if;
res := dbms_xdb.createResource('/public/newpersonDetails.xsd',xmlschema);
end;
which means that once the document newpersonDetails.xsd had been created once a subsequent execution of the testcase would fail as the document would already exist.
I'm also a little confused... Your testcase implies that you were able to insert the second document, but the number of rows in the table is still shown as 1 after the insert apparently succeeded. Since you did not correctly update the XML Schema before the calling copyEvolve I do not understand how your output shows that the second insert succeeded. -
Hi, I'm having trouble registering an XSD document that I want to build a schema from. In the following example where would the "XMLDIR" folder be located on a default Windows setup? Can someone please walk me through the basic steps from the start? I've had a look at the Oracle documentation but I cant seem to get it to work. (Im using Oracle 10g Express.)
BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd',
SCHEMADOC => bfilename('XMLDIR','purchaseOrder.xsd'),
CSID => nls_charset_id('AL32UTF8'));
END;Updated line to:
SCHEMADOC => bfilename('XSD_DIR','ODM1-3-0-foundation.xsd'),
and got error:
CREATE OR REPLACE DIRECTORY succeeded.
anonymous block completed
Error starting at line 25 in command:
BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'http://xmlns.oracle.com/xdb/documentation/ODM1-3-0-foundation.xsd',
SCHEMADOC => bfilename('XSD_DIR','ODM1-3-0-foundation.xsd'),
CSID => nls_charset_id('AL32UTF8'));
END;
Error report:
ORA-31000: Resource 'xml.xsd' is not an XDB schema document
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 37
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 61
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 126
ORA-06512: at line 2
31000. 00000 - "Resource '%s' is not an XDB schema document"
*Cause: The given schema URL does not refer to a registered XDB schema
*Action: Make sure the specified schema has been registered in XDB
Maybe you are looking for
-
I just downloaded iCloud on my MacBook Pro and iPhone. How do I download it to my MacBook Air from either of these devices?
-
ESSBASE 9.3.1 upgrade ( unix box)
I am planning on upgrading our essbase 9.3.0.1 to essbase 9.3.1. Please provide me an insight on how to do it and any problems or considerations ... And most of all I am looking for the documentation that gives guidence on how to perform upgrade. I w
-
Error when expecting "receive" from partnerLink
Hi, I keep getting this error after invoking a partnerlink (invoke) and expecting its response (receive). Here is the bpel snippet and the error: <invoke name="InvocarAgencyAsync" partnerLink="AgencyPartner" operation="SubmitTransaction" portType="ns
-
Cappture search button click of a view criteria
Hi is it possible to capture the click of a view criteria "Search filter". Search button click? Also, is it possible to have teh default of a view criteria to be set at "ALL" or "ANY"
-
Rollover buttons with unexpected results
Hello Folks, I'm hoping someone can point me in the right direction with a problem I'm having with rollover buttons. I've used Fireworks to create five rollover buttons with round corners onto a single transparent canvas. I've exported the images as