How to use numeric data type in XQuery

In this article I am going to explain numeric data type in XQuery.
  • 1878

Numeric data type is used for numeric value. Numeric data type are following types-

  • Decimal data type

    The xs:decimal data type represents a subset of the real numbers that can be represented by decimal numerals. Decimal data type largest precision is 31 digits.

Decimal has the following constraining facets-

  • totalDigits
  • fractionDigits
  • pattern
  • whiteSpace
  • enumeration
  • maxInclusive
  • maxExclusive
  • minInclusive
  • minExclusive

Example of Decimal data type

<xs:element name="Value" type="xs:decimal"/>

<Value>111.0</Value>

<Value>-1.1</Value>

<Value>+1.1</Value>

  • Integer data type

    The integer data type represents a numeric value without a fractional component. Derived from xs:decimal data type. Integer data type smallest value is -9 223 372 036 854 775 808 and largest value is +9 223 372 036 854 775 807.

Integer has the following constraining facets-

  • totalDigits
  • fractionDigits
  • pattern
  • whiteSpace
  • enumeration
  • maxInclusive
  • maxExclusive
  • minInclusive
  • minExclusive

Example of Integer data type

<xs:element name="Value" type="xs:integer"/>

<Value>110</Value>

<Value>-110</Value>

<Value>+110</Value>

<Value>0</Value>

Further Readings

You may also want to read these related articles: here

Ask Your Question 

Got a programming related question? You may want to post your question here
 
 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.