Neoview SQL Reference Manual (R2.4 SP2)
Collations
A collation contains rules for a collating sequence (the sequence in which characters are ordered
for sorting), case, and character class and character string equivalence. To be compared, character
strings must be from the same character set. When two strings are compared, the comparison is
made with a temporary copy of the shorter string that has been padded on the right with blanks
to have the same length as the longer string.
In Neoview SQL, a character data type can be associated only with the DEFAULT collation,
which compares the binary code values of characters in a character string. When comparing two
equal length strings, s1 and s2, Neoview SQL compares the binary code values of the
corresponding characters of s1 and s2 until it finds a difference. If Neoview SQL finds a difference
and the differing character value of s1 is less than that of s2, s1 is considered to come before
s2. If the differing character value of s2 is less than that of s1, s2 is considered to come before
s1. If there is no difference, s2 is considered equal to s2.
Datetime Data Types
A value of datetime data type represents a point in time according to the Gregorian calendar
and a 24-hour clock in local civil time (LCT). A datetime item can represent a date, a time, or a
date and time.
When a numeric value is added to or subtracted from a date type, the numeric value is
automatically CASTed to an INTERVAL DAY value. When a numeric value is added to or
subtracted from a time type or a timestamp type, the numeric value is automatically CASTed to
an INTERVAL SECOND value. For information on CAST, see “CAST Expression” (page 345).
Neoview SQL accepts dates, such as October 5 to 14, 1582, that were omitted from the Gregorian
calendar. This functionality is a Neoview SQL extension.
The range of times that a datetime value can represent is:
January 1, 1 A.D., 00:00:00.000000 (low value) December 31, 9999, 23:59:59.999999 (high value)
Neoview SQL has three datetime data types:
datetime-type is:
DATE
| TIME [(time-precision)]
| TIMESTAMP [(timestamp-precision)]
DATE
specifies a datetime column that contains a date in the external form yyyy-mm-dd and stored
in four bytes.
TIME [(time-precision)]
specifies a datetime column that, without the optional time-precision, contains a time in the
external form hh:mm:ss and is stored in three bytes. time-precision is an unsigned integer
that specifies the number of digits in the fractional seconds and is stored in four bytes. The
default for time-precision is 0, and the maximum is 6.
TIMESTAMP [(timestamp-precision)]
specifies a datetime column that, without the optional timestamp-precision, contains a
timestamp in the external form yyyy-mm-dd hh:mm:ss and is stored in seven bytes.
timestamp-precision is an unsigned integer that specifies the number of digits in the
fractional seconds and is stored in four bytes. The default for timestamp-precision is 6,
and the maximum is 6.
Data Types 237