DATEDIFF UDF
Some parts in the output code are omitted for clarity reasons.
Description
This UDF is used as a template for all cases when there is a subtraction between a DATE,
TIMESTAMP,
and any other type (except Intervals).
Custom UDF overloads
DATEDIFF_UDF(date, date)
Parameters
FIRST_PARAM: The first
DATE
of the operation.SECOND_PARAM: The
DATE
to be subtracted.
DATEDIFF_UDF(date, timestamp)
Parameters
FIRST_PARAM: The first
DATE
of the operation.SECOND_PARAM: The
TIMESTAMP
to be subtracted.
DATEDIFF_UDF(date, integer)
Parameters
FIRST_PARAM: The first
DATE
of the operation.SECOND_PARAM: The
INTEGER
to be subtracted.
DATEDIFF_UDF(timestamp, timestamp)
Parameters
FIRST_PARAM: The first
TIMESTAMP
of the operation.SECOND_PARAM: The
TIMESTAMP
to be subtracted.
DATEDIFF_UDF(timestamp, date)
Parameters
FIRST_PARAM: The first
TIMESTAMP
of the operation.SECOND_PARAM: The
DATE
to be subtracted.
DATEDIFF_UDF(timestamp, number)
Parameters
FIRST_PARAM: The first
TIMESTAMP
of the operation.SECOND_PARAM: The
NUMBER
to be subtracted.
Usage example
The unknown is a column whose type could not be resolved, it could be a timestamp, date integer, or number.
--disableDateAsTimestamp
Flag to indicate whether SYSDATE
should be transformed into CURRENT_DATE
or CURRENT_TIMESTAMP
. This will also affect all DATE
columns that will be transformed to TIMESTAMP
.
Oracle
Snowflake
Known Issues
1. Functional differences for timestamps
Sometimes the Snowflake value returned by the UDF may differ from the Oracle one due to the time. Consider the following example
Oracle
Snowflake
Related EWIs
SSC-EWI-OR0036: Types resolution issues, the arithmetic operation may not behave correctly between string and date.
SSC-FDM-OR0042: Date Type Transformed To Timestamp Has A Different Behavior.
Last updated