Dbms_xmlschema

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 15

Got 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;

Similar Messages

  • Dbms_xmlschema.registerschema, (ORA-31084: error while creating table )..

    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...

  • Problems with the function DBMS_XMLSCHEMA.copyEvolve

    I´m having problems with the evolution of xml-schema.
    First the function DBMS_XMLSCHEMA.copyEvolve works correctly, but since one week I get only errors. Strangely is the fact that I use the same files (xml-schema, xslt and xml instances) and the same SQL-Code. Even if I delete all tables, directories, ... with the drop instruction and create them again, I get only error messages. It is also strangely that the function DBMS_XMLSCHEMA.copyEvolve not works if the old and new xml-schema are identical and no XSLT-Stylesheet is handed over. Can by the function DBMS_XMLSCHEMA.copyEvolve something going wrong in the database ? Do I must recreate the database, and how can I do that by the XE? But that can not be a good solution.
    Has anybody a idea what can I do?
    Here is my error report:
    Error starting at line 1 in command:
    BEGIN
    DBMS_XMLSCHEMA.copyEvolve(
    schemaURLs => xdb$string_list_t('http://localhost:8080/internal/xmlschema/testschema.xsd'),
    newSchemas => XMLSequenceType(XDBURIType('/public/testschema_evolution.xsd').getXML()),
    transforms => XMLSequenceType(XDBURIType('/public/MapTotestschema_evolution.xslt').getXML()));
    END;
    Error report:
    ORA-30944: Fehler beim Rollback für XML-Schema "http://localhost:8080/internal/xmlschema/testschema.xsd" Tabelle "MYUSER"."XMLSCHEMATABELLE" Spalte ""
    ORA-02304: Ungültiges Objektidentifizierungsliteral
    ORA-30942: Fehler bei XML Schema Evolution für Schema "http://localhost:8080/internal/xmlschema/testschema.xsd" Tabelle <n/a> Spalte ""
    ORA-31088: Objekt "MYUSER"."BIN$QNQjNoYiRfC4KlQtnfUpMw==$0" hängt von Schema ab
    ORA-06512: in "XDB.DBMS_XMLSCHEMA_INT", Zeile 113
    ORA-06512: in "XDB.DBMS_XMLSCHEMA", Zeile 210
    ORA-06512: in Zeile 2
    Thanks David

    Can you try doing the following before running copyEvolve
    SQL> purge recyclebin
      2  /
    Recyclebin purged.
    SQL> alter session set recyclebin =  off
      2  /
    Session altered.
    SQL>and see if it works as expected.

  • Dbms_xmlschema package

    Hi,
    We upgraded our database from 8.1.6.3 to 9.2.0.3. In the recent version of database, I am unable to find DBMS_XMLSCHEMA package. What should I do?
    Thanks,
    Jatinder

    Could you please recommend which document specifically should I look into to resolve this issue.
    Thanks,
    Jatinder

  • 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

  • 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
    sem

    1) 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.generateschema - JAXB

    dbms_xmlschema.generateschema - JAXB
    We want to use our Oracle produced xsd to build JAVA content trees for unmarshalling and marshalling USING JAXB. The Oracle generated xsd does NOT nest complex sequence elements properly for JAXB. Any input is appreciated.
    Below is an example from the sun tutorial for using JAXB. Notice the ITEMS/ITEM structure. Below that is our example types, PL/SQL to generate xsd and the results.
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
    <xsd:element name="comment" type="xsd:string"/>
    <xsd:complexType name="PurchaseOrderType">
    <xsd:sequence>
    <xsd:element name="shipTo" type="USAddress"/>
    <xsd:element name="billTo" type="USAddress"/>
    <xsd:element ref="comment" minOccurs="0"/>
    <xsd:element name="items" type="Items"/>
    </xsd:sequence>
    <xsd:attribute name="orderDate" type="xsd:date"/>
    </xsd:complexType>
    <xsd:complexType name="USAddress">
    <xsd:sequence>
    <xsd:element name="name" type="xsd:string"/>
    <xsd:element name="street" type="xsd:string"/>
    <xsd:element name="city" type="xsd:string"/>
    <xsd:element name="state" type="xsd:string"/>
    <xsd:element name="zip" type="xsd:decimal"/>
    </xsd:sequence>
    <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
    </xsd:complexType>
    <xsd:complexType name="Items">
    <xsd:sequence>
    <xsd:element name="item" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="productName" type="xsd:string"/>
    <xsd:element name="quantity">
    <xsd:simpleType>
    <xsd:restriction base="xsd:positiveInteger">
    <xsd:maxExclusive value="100"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="USPrice" type="xsd:decimal"/>
    <xsd:element ref="comment" minOccurs="0"/>
    <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
    </xsd:sequence>
    <xsd:attribute name="partNum" type="SKU" use="required"/>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    <!-- Stock Keeping Unit, a code for identifying products -->
    <xsd:simpleType name="SKU">
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="\d{3}-[A-Z]{2}"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:schema>
    CREATE OR REPLACE TYPE sjs.Item AS OBJECT
    ( "productName"                    VARCHAR2(100),
    "quantity"               INTEGER
    CREATE OR REPLACE TYPE sjs.Items AS TABLE OF sjs.Item
    CREATE OR REPLACE TYPE sjs.purchaseOrder AS OBJECT
    ("comment"               VARCHAR2(100),
    "Items"               Items
    DECLARE
    RECURSE BOOLEAN := TRUE;
    ANNOTATE BOOLEAN := FALSE;
    EMBEDCOLL BOOLEAN := FALSE;
    Schemaurl VARCHAR2(10) := 'WWW';
    XSD_TYPE XMLTYPE;
    XSD_CLOB CLOB;
    XML_CLOB CLOB;
    XML_TYPE XMLsequenceTYPE;
    valid_flag INTEGER;
    p_out     CLOB;
    message VARCHAR2(4000);
    BEGIN
    EXECUTE IMMEDIATE 'CREATE OR REPLACE DIRECTORY XML_DIR AS ''C:\XMLAPI_PRODUCE''';
    XSD_TYPE := dbms_xmlschema.generateschema('SJS','ITEMS','purchaseOrder',RECURSE,ANNOTATE,EMBEDCOLL);
    XSD_CLOB := XSD_TYPE.getclobval;
    sjs.file_util.write_clob(XSD_CLOB,'po.xsd','C:\XMLAPI_PRODUCE');
    DBMS_LOB.CREATETEMPORARY(xml_CLOB,TRUE,dbms_lob.CALL);
    DBMS_LOB.OPEN(xml_CLOB, DBMS_LOB.LOB_READWRITE);
    DBMS_LOB.CREATETEMPORARY(xsd_CLOB,TRUE,dbms_lob.CALL);
    DBMS_LOB.OPEN(xsd_CLOB, DBMS_LOB.LOB_READWRITE);
    DBMS_LOB.CLOSE(xml_CLOB);
    DBMS_LOB.FREETEMPORARY(xml_CLOB);
    DBMS_LOB.CLOSE(xsd_CLOB);
    DBMS_LOB.FREETEMPORARY(xsd_CLOB);
    END;
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdb="http://xmlns.oracle.com/xdb" xsi:schemaLocation="http://xmlns.oracle.com/xdb http://xmlns.oracle.com/xdb/XDBSchema.xsd">
    <xsd:element name="purchaseOrder" type="ITEMSType"/>
    <xsd:complexType name="ITEMSType">
    <xsd:sequence>
    <xsd:element name="ITEMS_ITEM" type="ITEMType" maxOccurs="unbounded" minOccurs="0"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="ITEMType">
    <xsd:sequence>
    <xsd:element name="productName">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="100"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="quantity" type="xsd:integer"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>

    DB Structure
    Parent Table - Incident --> Child Table - IncidentCharges --> Child Table of IncidentCharges --> IncidentChargeWeapons
    Container
    Oracle Containers for JAVA(OC4J)
    We have a schema (Incident.xsd) which comprises of our entire database structure. We unmarshalled the schema using JAXB to Java classes and interfaces .
    It created 2 .java classes and 2 .java interfaces for each high level tag . for eg for our Incident tag it created a Incident interface and a IncidentType Interface
    and also it created 2 classes IncidentImpl and IncidentTypeImpl . The IncidentTypeImpl has all the get and set properties we require eg. getIncidentType,
    setIncidentType,getIncidentNumber,setIncidentNumber,getOccuranceDate,setOccuranceDate etc.
    Our objective is to create a JSP page which has form fields to enter data which use these JAXB generated classes get and set properties. In other words
    we want to bind the JSP form fields to these JAXB generated classes. And once these JAXB objects are populated we want to marshal it and create a XML file with the data from those JAXB . Our database would then consume the generated XML. We tried creating a simple incident form with just 3 fields IncidentType,Occurance date and Incident Number and tried to bind these fields with the properties from IncidentTypeImpl classes using the <jsp:usebean> tag . When we deployed it to our container and tried to load the Incident.jsp page , it would not load up . Only when we cleared all the bindings it loaded up .
    Then we tried another workaround (just to get it working. Not a preferred approach) . We created another simple JAVA bean(not JAXB generated beans) which has set and get properties for the form fields and bound the form fields to it.
    On submitting the JSP page we called a servlet which takes data from our created bean and transfers it to the JAXB generated IncidentTypeImpl bean. When we deployed this the jsp page loads up and also our bean is filled with data . But the servlet bombs with this error below.
    500 Internal Server Error
    java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
         at Servlets.IncidentServlet.doPost(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    We have 2 questions .
    1. Can a JSP page be bound directly to this JAXB generated bean in pretty much the same way as we bind it to our own bean ? (We would like to do this so that we dont have to create duplicate classes which mirror the JAXB generated classes.)
    2. Is there something special we have to do to deploy this application to recognize the JAXB classes. Do we have to deploy some jar file for it to recognize those classes ?

  • Oracle documentation DBMS_XMLSCHEMA.REGISTER_SCHEMA

    Hi All,
    I need an oracle documentation for the procedure DBMS_XMLSCHEMA.REGISTER_SCHEMA. Could you plz send me a good oracle / non-oracle link that would tell in details about what are the input and output parameters for this procedure and what it does.
    Thanks in advance
    -Aditi

    See the following sections of the Oracle Doc
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb03usg.htm#sthref267
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb05sto.htm#sthref644
    http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xmlsch.htm#i1008494

  • 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.

  • 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 ?
    Gregor

    Which 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
    /

  • Dbms_Xmlschema Copyevolve

    (10gR2) I have a schema based xmltype column inside an audit table.
    Name Null Type
    AUDIT_ID NUMBER
    XML_DOCUMENT XMLTYPE()
    A new Schema is now in place and I want to register the new schema and use the existing table and columns to insert these new XMLs. I used Dbms_Xmlschema.Copyevolve with a stylesheet and works perfectly. I now have fully validated XMLs against the new Schema.
    However, copyevolve drops the old Schema and registers the new schema using the old schema URI.
    Is there a way for copyevolve to rename the schema URI?
    The problem I have is that new XMLs being parsed are using the new schemaLocation name.

    (10gR2) I have a schema based xmltype column inside an audit table.
    Name Null Type
    AUDIT_ID NUMBER
    XML_DOCUMENT XMLTYPE()
    A new Schema is now in place and I want to register the new schema and use the existing table and columns to insert these new XMLs. I used Dbms_Xmlschema.Copyevolve with a stylesheet and works perfectly. I now have fully validated XMLs against the new Schema.
    However, copyevolve drops the old Schema and registers the new schema using the old schema URI.
    Is there a way for copyevolve to rename the schema URI?
    The problem I have is that new XMLs being parsed are using the new schemaLocation name.

  • DBMS_XMLSCHEMA.COPYEVOLVE failing with ORA-06502 ORA-30942 and ORA-30944

    Hi all,
    We have a procedure we're testing to evolve XML schemas. Fairly simple and straightforward, and on our development box (Win Server 2003) it works fine. However on our test server (Solaris) we get this -
    tdm@TDMRSTG>Alter session set RECYCLEBIN=off
    2 ;
    Session altered.
    Elapsed: 00:00:00.00
    tdm@TDMRSTG>
    1 begin
    2 tdm_maintenance_pkg.EVOLVE_SCHEMA(
    3 'http://uk-LONDBS006:8080/public/TDM/xsd/TDM_Computation_1_2_3.xsd',
    4 'XMLDIR',
    5 'evolveTDM_Computation_1.xsd'
    6 );
    7* end;
    tdm@TDMRSTG>/
    begin
    ERROR at line 1:
    ORA-30944: Error during rollback for XML schema 'http://uk-LONDBS006:8080/public/TDM/xsd/TDM_Computa
    "TDM"."TDM_COMPUTATION" column 'XML'
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    ORA-30942: XML Schema Evolution error for schema 'http://uk-LONDBS006:8080/public/TDM/xsd/TDM_Comput
    "TDM"."TDM_COMPUTATION" column 'XML'
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 113
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 210
    ORA-06512: at "TDM.TDM_MAINTENANCE_PKG", line 47
    ORA-06512: at line 2
    Elapsed: 00:01:43.03
    tdm@TDMRSTG>
    Here's the listing of the procedure -
    PROCEDURE evolve_schema ( p_oldSchema IN VARCHAR2
    , p_directory IN VARCHAR2
    , p_newSchema IN VARCHAR2 )
    IS
    BEGIN
    DBMS_XMLSCHEMA.COPYEVOLVE(
    xdb$string_list_t(p_oldSchema),
    XMLSequenceType(xmltype(getXml(p_Directory,p_newSchema)) )
    END;
    We're all pretty new to all of this, so any help would be grately appreciated.
    Regards
    Geoff.

    Hello
    You are selecting 8000 characters from position 4001, not 4000 characters from position 4001....
      FUNCTION substr(lob_loc IN BLOB,
                      amount  IN INTEGER := 32767,
                      offset  IN INTEGER := 1)dbms_lob.substr(billing_inventory,4000,1),dbms_lob.substr(billing_inventory,8000,4001)
    You need to modify the 2nd substr in each select statement to be
    dbms_lob.substr(billing_inventory,4000,1),dbms_lob.substr(billing_inventory,4001,4000)
    HTH
    David
    Edited by: David Tyler on Jun 27, 2011 1:16 PM

  • Dbms_xmlschema's automatic type generation

    Hi,
    I would like to import XML documents in Oracle 9i Release 2 which contain a structure like this:
    <TEST>
    <TEST/>
    <TEST/>
    </TEST>
    I am using the following schema definition:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://www.informatik.hu-berlin.de/~vitt/test"
    xmlns:t="http://www.informatik.hu-berlin.de/~vitt/test"
    >
    <xs:complexType name="C_TEST">
    <xs:sequence>
    <xs:element minOccurs="0" maxOccurs="unbounded" ref="t:TEST" />
    </xs:sequence>
    </xs:complexType>
    <xs:element name="TEST" type="t:C_TEST"/>
    </xs:schema>
    I am importing this schema using PL/SQL's DBMS_XMLSCHEMA.registerURI with the default options, i.e. automatic type and table generation turned on. Unfortunately, this does not quite work as expected. If I ask SQL*Plus to describe the created table, Oracle disconnects:
    SQL> describe TEST4711_TAB
    ERROR:
    ORA-03113: end-of-file on communication channel
    Describing the created types shows that something went wrong:
    SQL> describe C_TEST4710_T
    C_TEST4710_T is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    TEST REF OF XMLTYPE
    SQL> describe TEST4712_COLL
    TEST4712_COLL VARRAY(2147483647) OF C_TEST4710_T
    TEST4712_COLL is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    TEST REF OF XMLTYPE
    As far as I understand, the TEST element of C_TEST4710_T should be of the TEST4712_COLL type, not simply a REF OF XMLTYPE, as there may be more than one TEST XML elements inside a TEST element.
    How can I get around this problem?
    TIA,
    Thorsten

    Hi,
    What version of Oracle are you using?9.2.0.1.0
    Have you looked at your server to see if the Oracle
    instance is creating any trace or dump files?The DESCRIBE command mentioned in my original post results in the following written to the alert_lehre.log file:
    Mon Aug 30 16:59:57 2004
    Errors in file /oracle/lehre/admin/lehre/udump/lehre_ora_7673.trc:
    ORA-07445: exception encountered: core dump [qmtAddProperty()+783] [SIGSEGV] [Address not mapped to object] [0x29] [] []
    Currently, I do not have access to the trace file, though.
    Have you tried a different version of SQLplus just to
    see if it does the describe?No. However, I get the same error (and the same alert.log entry) when I try to insert a sample XML file into the table, as well from SQLplus as from a third-party tool using OCI.
    I seem to have found a workaround now -- a slight reformulation of the XML Schema definition appears to make Oracle create a correct type definition:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="http://www.informatik.hu-berlin.de/~vitt/test"
    xmlns:t="http://www.informatik.hu-berlin.de/~vitt/test"
    >
    <xs:complexType name="C_TEST">
    <xs:sequence>
    <!-- old: <xs:element minOccurs="0" maxOccurs="unbounded" ref="t:TEST" /> -->
    <xs:element minOccurs="0" maxOccurs="unbounded" name="TEST" type="t:C_TEST"/>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="TEST" type="t:C_TEST"/>
    </xs:schema>
    SQL> describe C_TEST6847_T;
    C_TEST6847_T is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    TEST XDB.XDB$XMLTYPE_REF_LIST_T
    -- Thorsten

  • Problems with DBMS_XMLSCHEMA.generateBean

    I'm having a problem with the generateBean function. Whenever I try to run it (either standalone, or indirectly through the registerSchema function), I get the following message:
    ERROR at line 1:
    ORA-03001: unimplemented feature
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 47
    ORA-06512: at line 2
    Any ideas? I have the complete Oracle 9i Release 2 Enterprise Edition package installed.

    This feature was present in the beta for 9iR2 but removed from final release of the 9.2.0.1.0 product. The reason behind that was that the JAX/B standard switched from DTD to XMLSCHEMA. This made it possible for us to develop an implentation of generateBean that was compliant with the JAX/B spec.
    Unfortunately it was too late to include the new version as part of the 9.2.x product line. Consequently we took the (hard) decision to remove the work we had done from 9.2.0.1.0 in order to be able to release a standards compliant version in a later release...

  • Help with DBMS_XMLSCHEMA.copyEvolve Transforms Parameter

    Oracle 11gr2 on Linux VM
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 22 13:51:28 2012
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Enter user-name: jmendez
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    BANNER
    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 Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production I'm not sure how to properly use the DBMS_XMLSCHEMA.copyEvolve procedure. I'm trying to evolve a schema (ArchivalTypes) and its dependent schema (collection). There are lots of transformations for the collection schema but Archival Types is just a schema made up of Arrays referenced in the collection schema (and eventually 4 other schemas). I don't "think" I need an XSL for archivalTypes... so how do I enter a null value since the transforms parameter in the procedure requires XSL files to be specified in the exact order as the schema files were listed (sorry if I'm not making sense). Below is my command:
    BEGIN
      DBMS_XMLSCHEMA.copyEvolve(
        xdb$string_list_t('http://localhost/xsd/test/ArchivalTypes_test.xsd','http://localhost/xsd/test/Collection.xsd'),
        XMLSequenceType(XDBURIType('/u01/app/xsd/test/ArchivalTypesEvolve.xsd').getXML(),XDBURIType('/u01/app/xsd/test/Collection_Evolve.xsd').getXML()),
        XMLSequenceType(XDBURIType('/u01/app/xsd/test/Collection_Evolve.xsl').getXML()));
    END;
    /I appreciate any help I can get here.

    Actually, I don't know why I didn't think about this before but it worked without having to "evolve" ArchiveTypes. ArchiveTypesEvolve is included in the new collection.xsd like so:
         <xs:include schemaLocation="http://localhost/xsd/test/ArchivalTypesEvolve.xsd"/>Does it make sense then? When I do schema evolution I just specify Collection.xsd and it works?
    BEGIN
      DBMS_XMLSCHEMA.copyEvolve(
        xdb$string_list_t('http://localhost/xsd/test/Collection.xsd'),
        XMLSequenceType(XDBURIType('/u01/app/xsd/test/Collection_Evolve.xsd').getXML()),
        XMLSequenceType(XDBURIType('/u01/app/xsd/test/Collection_Evolve.xsl').getXML()));
    END;
    /Should I be concerned that it worked this way? All the mapping was correct and the data looks good. I just thought it would be a little more complicated since Collection_test used ArchivalTypes and the new Collection_Evolve uses ArchivalTypesEvolve.

Maybe you are looking for