Hello All,
I use Oracle 19c, I get the following error. The thing is, I send the data as 32437.10
Probably it is converted to number therefore it is evaluated like 32437.1
and it gives an error. What do you suggest?
I want to send the data as is, probably it is changed.
DECLARE
v_clob clob := q'~<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="report">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="records" type="recordstype" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="recordstype">
<xsd:sequence>
<xsd:element name="record" type="recordtype" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="recordtype">
<xsd:sequence>
<xsd:element name="amntfc" type="amnttype" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="recordtype" type="recordtypetype" use="required"/>
</xsd:complexType>
<xsd:simpleType name="recordtypetype">
<xsd:restriction base="xsd:string">
<xsd:pattern value="E|D|S|I"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="amnttype">
<xsd:restriction base="xsd:decimal">
<xsd:pattern value="(0\.0[1-9])|(0\.[1-9][0-9])|([1-9][0-9]{0,15}\.[0-9]{2})"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>~';
BEGIN
dbms_xmlschema.registerSchema(schemaURL => 'test.xsd',
schemaDoc => v_clob);
END;
DECLARE
l_xml CLOB;
l_xmltype XMLTYPE;
BEGIN
l_xmltype := XMLTYPE('<report>
<records>
<record recordtype="E">
<amntfc>32437.10</amntfc>
</record>
</records>
</report>', 'test.xsd');
l_xmltype.schemavalidate;
END;
ORA-31154: invalid xml document
ORA-19202: error occurred in xml processing
LSX-00333: "32437.1" literal is not valid with respect to the pattern
LSX-00213: only 0 occurrences of particle sequence minimum is 1
ORA-06512: at "SYS.XMLTYPE", line 354
ORA-06512: at line 13
Thanks in advance