If the character string in a character-to-TIME conversion omits the hour, minute, or second, the system uses default values for the target TIME value.
IF the character string omits the … | THEN the system uses the … |
---|---|
hour | value of 0. |
minute | |
second |
Consider the following table:
CREATE TABLE time_log (id INTEGER ,start_time TIME ,end_time TIME ,log_time TIME);
The following INSERT statement converts three character strings to TIME values. The first character string omits the hour, the second character string omits the minute, and the third character string omits the second.
INSERT time_log (1001 ,CAST ('01:02.030405' AS TIME FORMAT 'MI:SS.S(6)') ,CAST ('01:02.030405' AS TIME FORMAT 'HH:SS.S(6)') ,CAST ('01:02' AS TIME FORMAT 'HH:MI'));
The result of the INSERT statement is as follows:
SELECT * FROM time_log; id start_time end_time log_time ----------- --------------- --------------- --------------- 1001 00:01:02.030405 01:00:02.030405 01:02:00.000000