Neoview SQL Reference Manual (R2.5)

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 '2008-09-28 00:00:00' >
TIMESTAMP '2008-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
Neoview SQL provides support for extended numeric precision data type. Extended numeric
precision is an extension to the NUMERIC(x,y) data type where no theoretical limit exists on
precision. It is a software data type, which means that the underlying hardware does not support
it and all computations are performed by software. Computations using this data type may not
match the performance of other hardware supported data types.
Considerations for Extended NUMERIC Precision Data Type
Consider these points and limitations for extended NUMERIC precision data type:
May cost more than other data type options.
Is a software data type.
Cannot be compared to data types that are supported by hardware.
Not supported for host variable declarations in embedded programs.
If your application requires extended NUMERIC precision arithmetic expressions, specify
the required precision in the table DDL or as explicit extended precision type casts of your
select list items. The default system behavior is to treat user-specified extended precision
expressions as extended precision values. Conversely, non-user-specified (that is, temporary,
intermediate) extended precision expressions may lose precision. In the following example,
the precision appears to lose one digit because the system treats the sum of two
NUMERIC(18,4) type columns as NUMERIC(18,4). NUMERIC(18) is the longest non-extended
precision numeric type. NUMERIC(19) is the shortest extended precision numeric type. The
system actually computes the sum of 2 NUMERIC(18,4) columns as an extended precision
246 SQL Language Elements