My Oracle Support Banner

DBMS_XMLSCHEMA.registerSchema fails with an ORA-31162 (Doc ID 1320523.1)

Last updated on FEBRUARY 26, 2019

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.3 to 11.2.0.2 [Release 10.2 to 11.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.

Symptoms

Registering an XML schema fails with errors.

SQL> begin
  2 DBMS_XMLSCHEMA.registerSchema(
  3 SCHEMAURL => 'http://www.MyXMLSchema.xsd',
  4 SCHEMADOC => '<?xml version="1.0" encoding="windows-1252"?>
  5 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  6            elementFormDefault="qualified">
  7         <!-- DEF of complex type xxType2 -->
  8         <xs:complexType name="xxType2">
  9            <xs:sequence>
 10                 <xs:element name="xxElem2" maxOccurs="2">
 11                    <xs:complexType>
 12                         <xs:complexContent>
 13                            <xs:extension base="xxType1">
 14                                 <xs:attribute name="xxAttr1" type="xs:string"/>
 15                            </xs:extension>
 16                         </xs:complexContent>
 17                    </xs:complexType>
 18                 </xs:element>
 19                 <xs:element name="xxElem3" type="xs:string"/>
 20            </xs:sequence>
 21         </xs:complexType>
 22         <!-- DEF of complex type xxType1 -->
 23         <xs:complexType name="xxType1">
 24            <xs:sequence>
 25                 <xs:element name="xxElem1" type="xs:string"/>
 26            </xs:sequence>
 27         </xs:complexType>
 28 </xs:schema>',
 29 LOCAL => TRUE,
 30 gentypes=> FALSE,
 31 gentables=> FALSE,
 32 FORCE => FALSE);
 33 end;
 34 /
begin
*
ERROR at line 1:
ORA-31162: element or attribute "xxElem2" has no SQLType specified
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 3
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 14
ORA-06512: at line 2


Registering the same XML schema with genTypes = TRUE succeeds.

 ...
 26            </xs:sequence>
 27         </xs:complexType>
 28 </xs:schema>',
 29 LOCAL => TRUE,
 30 gentypes=> TRUE,
 31 gentables=> FALSE,
 32 FORCE => FALSE);
 33 end;
 34 /

PL/SQL procedure successfully completed.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.