EXTRACT_TIMESTAMP_DIFFERENCE_UDF
Some parts of the output code are omitted for clarity reasons.
Definition
Extracts 'Data Part' from the result of the subtraction MINUEND
- SUBTRAHEND
Differences between Teradata and Snowflake date-time extraction
Teradata and Snowflake differ in the parameters that each function respectively might receive and the return type.
Parameters: The main difference between Teradata and Snowflake extract function is that Snowflake does not handle intervals, it only supports dates and times. For further information on this, read Snowflake's EXTRACT function documentation and Teradata's EXTRACT function documentation.
Return type: Teradata EXTRACT function returns an integer or decimal(8, 2) value representing the part requested and Snowflake returns a number value representing a date-time of the part requested.
Teradata and Snowflake differ in the parameters that each function respectively might receive and the return type.
Parameters
MINUEND
TIMESTAMP
Date subtracted from.
SUBTRAHEND
TIMESTAMP
Date subtracted.
INPUT_PART
VARCHAR
Formatted varchar, is the original requested part (same as TIMESTAMP_DIFERENCE
INPUT_PART
) and must be one of these:
'DAY TO HOUR'
'DAT TO MINUTE'
'DAY TO SECOND'
'DAY TO MINUTE'
'HOUR TO MINUTE'
'HOUR TO SECOND'
'MINUTE TO SECOND'
EXTRACT_PART
VARCHAR
Value to be extracted, the request part should be contained in the input part interval, must be 'DAY'
, 'HOUR'
, 'MINUTE'
or 'SECOND'
.
Returns
The number of requests part of the extract.
Example
Input:
Output:
Last updated