ALLBASE/SQL Reference Manual (36216-90216)

Chapter 7 217
Data Types
Date/Time Operations
Date/Time Operations
DATE, TIME, DATETIME, or INTERVAL values may only be assigned to a column with a
matching data type or to a fixed or variable length character string column or host
variable. Otherwise an error condition is generated. All rules regarding assignment to a
character string are also true for date/time assignment to a character string variable or
column.
Conversions of the individual fields of a date/time data type follow the rules given earlier
in this subsection for the corresponding data type.
NOTE
The validity of dates prior to 1753 (transition of Julian to Gregorian calendar)
cannot be guaranteed.
DATE, TIME, DATETIME, and INTERVAL data types behave similar to character strings
in data manipulation statements. The examples below illustrate this.
Examples
INSERT
DATETIME, DATE, TIME and INTERVAL values:
INSERT INTO ManufDB.TestData
(BatchStamp, TestDate, TestStart, TestEnd, LabTime, PassQty, TestQty)
VALUES ('1984-08-19 08:45:33.123',
'1984-08-23',
'08:12:19', '13:23:01',
'5 10:35:15.700',
49, 50)
SELECT
DATE and TIME values:
SELECT TestDate, TestStart
FROM ManufDB.TestData
WHERE TestDate = '1984-08-23'
DATETIME and INTERVAL values:
SELECT BatchStamp, LabTime
FROM ManufDB.TestData
WHERE TestDate = '1984-08-23'
UPDATE
DATE and TIME values:
UPDATE ManufDB.TestData
SET TestDate = '1984-08-25', TestEnd = '19:30:00'
WHERE BatchStamp = '1984-08-19 08:45:33.123'