SQL/MX 3.2 Reference Manual (H06.25+, J06.14+)

SQL/MX Language Elements
HP NonStop SQL/MX Release 3.2 Reference Manual691117-001
6-18
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.
Extended NUMERIC Precision
SQL/MX provides support for extended NUMERIC precision data type. Extended
NUMERIC is either a signed numeric value with precision greater than 18 or an
unsigned numeric value with precision greater than 9.
Note. Dynamic SQL programs must convert the extended NUMERIC precision data type to
other compatible data types, such as CHAR.