SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-17
Comparable and Compatible Data Types
Datetime Data Types
Values of type datetime are mutually comparable and mutually assignable only if the
types have the same datetime fields. A DATE, TIME, or TIMESTAMP value can be
compared with another value only if the other value has the same data type.
All comparisons are chronological. For example, this predicate is true:
TIMESTAMP '1997-09-28 00:00:00' >
TIMESTAMP '1997-06-26 00:00:00'
Interval Data Types
Values of type INTERVAL are mutually comparable and mutually assignable only if the
types are either both year-month intervals or both day-time intervals.
For example, this predicate is true:
INTERVAL '02-01' YEAR TO MONTH > INTERVAL '00-01' YEAR TO MONTH
The field components of the INTERVAL do not have to be the same. For example, this
predicate is also true:
INTERVAL '02-01' YEAR TO MONTH > INTERVAL '01' YEAR
Numeric Data Types
Values of the approximate data types FLOAT, REAL, and DOUBLE PRECISION, and
values of the exact data types NUMERIC, DECIMAL, INTEGER, SMALLINT, and
LARGEINT, are all numbers and are all mutually comparable and mutually assignable.
When an approximate data type value is assigned to a column with exact data type,
rounding might occur, and the fractional part might be truncated. When an exact data
type value is assigned to a column with approximate data type, the result might not be
identical to the original number.
When two numbers are compared, the comparison is made with a temporary copy of
one of the numbers, according to defined rules of conversion. For example, if one
number is INTEGER and the other is DECIMAL, the comparison is made with a
temporary copy of the integer converted to a decimal.
Floating-Point Data
NonStop SQL/MX Release 2.x uses IEEE floating-point format internally and
automatically converts Tandem floating-point formats used in host variables or SQL/MP
tables. However, that conversion can cause rounding errors, or it can fail for extremely
large or extremely small values. Therefore, your programs might experience a
difference in the results compared to previous releases of NonStop SQL/MX.
Applications might not be able to retrieve rows using floating-point values in equal
comparison predicates by using these columns for some floating-point values.