Character Strings That Omit Hour, Minute, or Second

Teradata Vantage™ Data Types and Literals

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

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