NUMTODSINTERVAL
Purpose
Converts numeric_value into an INTERVAL DAY(4) TO SECOND(6) value.
Syntax
where:
Syntax element … |
Specifies … |
TD_SYSFNLIB |
the name of the database where the function is located. |
numeric_value |
a numeric argument. If numeric_value is NULL, NULL is returned |
interval_unit |
a character argument. interval_unit specifies the unit of value for numeric_value. It must be one of the following case-insensitive values: Any value that overflows the INTERVAL DAY(4) TO SECOND(6) value results in an error. If interval_unit is NULL, NULL is returned. |
ANSI Compliance
This is a Teradata extension to the ANSI SQL:2011 standard.
Invocation
NUMTODSINTERVAL is an embedded services system function. For information on activating and invoking embedded services functions, see “Embedded Services System Functions” on page 24.
Argument Types and Rules
Expressions passed to this function must have the following data types:
Result Type
The return value data type is INTERVAL DAY(4) TO SECOND(6).
Example
The following query:
SELECT NUMTODSINTERVAL(100, 'DAY');
returns the result '100 00:00:00.000000', which is 100 days.
Example
The following query:
SELECT NUMTODSINTERVAL(100, 'HOURS');
returns the result '4 04:00:00.000000', which is 4 days, 4 hours.
Example
The following query:
SELECT NUMTODSINTERVAL(1600, 'MINUTES');
returns the result '1 02:40:00.000000', which is 1 day, 2 hours, 40 minutes.
Example
The following query:
SELECT NUMTODSINTERVAL(3.5, 'HOURS');
returns the result 3 hours, 30 minutes.