Types by category

Db2 XQuery has the following categories of types: generic, untyped, string, numeric, date, time, duration, and other.

Generic data types

Table 1. Generic data types
Type Description
anyType data type The xs:anyType data type encompasses any sequence of zero or more nodes and zero or more atomic values.
anySimpleType data type The xs:anySimpleType data type denotes a context where any simple type can be used. This data type serves as the base type for all simple types. An instance of a simple type can be any sequence of atomic values. Derived from the xs:anyType data type.
anyAtomicType data type The xdt:anyAtomicType data type denotes a context where any atomic type can be used. This data type serves as the base type for all atomic types. An instance of an atomic type is a single nondecomposable value such as an integer, a string, or a date.

Untyped data types

Table 2. Untyped data types
Type Description
untyped data type The xdt:untyped data type denotes a node that has not been validated by an XML schema. Derived from data type xs:anyType.
untypedAtomic data type The xdt:untypedAtomic data type denotes an atomic value that has not been validated by an XML schema. Derived from data type xdt:anyAtomicType.

String data types

Table 3. String data types
Type Description
string data type The xs:string data type represents a character string. Derived from data type xdt:anyAtomicType.
normalizedString data type The xs:normalizedString data type represents a white space-normalized string. Derived from data type xs:string.
token data type The xs:token data type represents a tokenized string. Derived from the xs:normalizedString data type.
language data type The xs:language data type represents a natural language identifier as defined by RFC 3066. Derived from data type xs:token.
NMTOKEN data type The xs:NMTOKEN data type represents the NMTOKEN attribute type from XML 1.0 (Third Edition). Derived from the xs:token data type.
Name data type The xs:Name data type represents an XML Name. Derived from the xs:token data type.
NCName data type The xs:NCName data type represents an XML noncolonized name. Derived from the xs:Name data type.
ID data type The xs:ID data type represents the ID attribute type from XML 1.0 (Third Edition). Derived from xs:NCName data type.
IDREF data type The xs:IDREF data type represents the IDREF attribute type from XML 1.0 (Third Edition). Derived from the xs:NCName data type.
ENTITY data type The xs:ENTITY data type represents the ENTITY attribute type from XML 1.0 (Third Edition). Derived from the xs:NCName data type.

Numeric data types

Table 4. Numeric data types
Type Description
decimal data type The xs:decimal data type represents a subset of the real numbers that can be represented by decimal numerals. Derived from data type xdt:anyAtomicType.
float data type The xs:float data type is patterned after the IEEE single-precision 32-bit floating point type. Derived from data type xdt:anyAtomicType.
double data type The xs:double data type is patterned after the IEEE double-precision 64-bit floating point type. Derived from data type xdt:anyAtomicType.
int data type The xs:int data type represents an integer that is less than or equal to 2 147 483 647 and greater than or equal to -2 147 483 648. Derived from the xs:long data type.
nonPositiveInteger data type The xs:nonPositiveInteger data type represents an integer that is less than or equal to zero. Derived from the xs:integer data type.
negativeInteger data type The xs:negativeInteger data type represents an integer that is less than zero. Derived from data type xs:nonPositiveInteger.
nonNegativeInteger data type The xs:nonNegativeInteger data type represents an integer that is greater than or equal to zero. Derived from the xs:integer data type.
long data type The xs:long data type represents an integer that is less than or equal to 9 223 372 036 854 775 807 and greater than or equal to -9 223 372 036 854 775 808. Derived from data type xs:integer.
integer data type The xs:integer data type represents a number that is less than or equal to 9 223 372 036 854 775 807 and greater than or equal to -9 223 372 036 854 775 808. Derived from xs:decimal data type.
short data type The xs:short data type represents an integer that is less than or equal to 32 767 and greater than or equal to -32 768. Derived from the xs:int data type.
byte data type The xs:byte data type represents an integer that is less than or equal to 127 and greater than or equal to -128. Derived from the xs:short data type.
unsignedLong data type The xs:unsignedLong data type represents an unsigned integer that is less than or equal to 9 223 372 036 854 775 807. Derived from the xs:nonNegativeInteger data type.
unsignedInt data type The xs:unsignedInt data type represents an unsigned integer that is less than or equal to 4 294 967 295. Derived from xs:unsignedLong data type.
unsignedShort data type The xs:unsignedShort data type represents an unsigned integer that is less than or equal to 65 535. Derived from the xs:unsignedInt data type.
unsignedByte data type The xs:unsignedByte data type represents an unsigned integer that is less than or equal to 255. Derived from xs:unsignedShort data type.
positiveInteger data type The xs:positiveInteger data type represents a positive integer that is greater than or equal to 1. Derived from the xs:nonNegativeInteger data type.

Date, time, and duration data types

Table 5. Date, time, and duration data types
Type Description
duration data type The xs:duration data type represents a duration of time that is expressed by the Gregorian year, month, day, hour, minute, and second components. Derived from data type xdt:anyAtomicType.
yearMonthDuration data type The xdt:yearMonthDuration data type represents a duration of time that is expressed by the Gregorian year and month components. Derived from the xs:duration data type.
dayTimeDuration data type The xdt:dayTimeDuration data type represents a duration of time that is expressed by days, hours, minutes, and seconds components. Derived from the xs:duration data type.
dateTime data type The xs:dateTime data type represents an instant that has the following properties: year, month, day, hour, and minute properties that are expressed as integer values; a second property that is expressed as a decimal value; and an optional time zone indicator. Derived from data type xdt:anyAtomicType.
date data type The xs:date data type represents an interval of exactly one day in duration that begins on the first moment of a specific day. The xs:date data type consists of year, month, and day properties that are expressed as integer values and an optional time zone indicator. Derived from the xdt:anyAtomicType data type.
time data type The xs:time data type represents an instant of time that recurs every day. Derived from data type xdt:anyAtomicType.
gYearMonth data type The xs:gYearMonth data type represents a specific Gregorian month in a specific Gregorian year. Gregorian calendar months are defined in ISO 8601. Derived from data type xdt:anyAtomicType.
gYear data type The xs:gYear data type represents a Gregorian calendar year. Gregorian calendar years are defined in ISO 8601. Derived from data type xdt:anyAtomicType.
gMonthDay data type The xs:gMonthDay data type represents a Gregorian date that recurs. Gregorian calendar dates are defined in ISO 8601. Derived from data type xdt:anyAtomicType.
gDay data type The xs:gDay data type represents a Gregorian day that recurs. Gregorian calendar days are defined in ISO 8601. Derived from data type xdt:anyAtomicType.
gMonth data type The xs:gMonth data type represents a Gregorian month that recurs every year. Gregorian calendar months are defined in ISO 8601. Derived from data type xdt:anyAtomicType.

Other data types

Table 6. Other data types
Type Description
boolean data type The xs:boolean data type supports the mathematical concept of binary-valued logic: true or false. Derived from data type xdt:anyAtomicType.
anyURI data type The xs:anyURI data type represents a Uniform Resource Identifier (URI). Derived from data type xdt:anyAtomicType.
QName data type The xs:QName data type represents an XML qualified name (QName). A QName includes an optional namespace prefix, a URI that identifies the XML namespace, and a local part, which is an NCName. Derived from data type xdt:anyAtomicType.
NOTATION data type The xs:NOTATION data type represents the NOTATION attribute type from XML 1.0 (Third Edition). Derived from data type xdt:anyAtomicType.
hexBinary data type The xs:hexBinary data type represents hex-encoded binary data. Derived from data type xdt:anyAtomicType.
base64Binary data type The xs:base64Binary data type represents base64-encoded binary data. Derived from data type xdt:anyAtomicType.