XML : XML Schema totalDigits/fractionDigits vs. SQL precision/scale

I'd like to find out the correspondence between XML Schema totalDigits/fractionDigits and SQL numeric precision/scale.

1) Assume we have the following simple type:

  <xs:simpleType name="DecimalNumber">      <xs:restriction base="xs:decimal">          <xs:fractionDigits value="17"/>          <xs:totalDigits value="18"/>      </xs:restriction>  </xs:simpleType>    

How would I represent it in SQL? Let's assume HSQL dialect (it does not matter much). I'm interested in the most restrictive SQL type which could hold all the values from the value space of the XML Schema simple type.

Would it be numeric(18,17)? Or numeric(35,17)?

2) What if we have just totalDigits?

  <xs:simpleType name="DecimalNumber">      <xs:restriction base="xs:decimal">          <xs:totalDigits value="18"/>      </xs:restriction>  </xs:simpleType>    

What would be an adequate representation in SQL?

3) Or just fractionDigits?

  <xs:simpleType name="DecimalNumber">      <xs:restriction base="xs:decimal">          <xs:fractionDigits value="17"/>      </xs:restriction>  </xs:simpleType>    

No comments:

Post a Comment