DATEADD UDF
Description
This UDF is used as a template for all cases when there is an addition between a DATE or TIMESTAMP type and FLOAT type.
Custom UDF overloads
DATEADD_UDF(date, float)
Parameters
FIRST_PARAM: The first
DATEof the operation.SECOND_PARAM: The
FLOATto be added.
CREATE OR REPLACE FUNCTION PUBLIC.DATE_ADD_UDF(FIRST_PARAM DATE, SECOND_PARAM FLOAT)
RETURNS DATE
LANGUAGE SQL
IMMUTABLE
AS
$$
SELECT FIRST_PARAM + SECOND_PARAM::NUMBER
$$;DATEADD_UDF(float, date)
Parameters
FIRST_PARAM: The
FLOATto be added.SECOND_PARAM: The
DATEof the operation.
DATEADD_UDF(timestamp, float)
Parameters
FIRST_PARAM: The first
TIMESTAMPof the operation.SECOND_PARAM: The
FLOATto be added.
DATEADD_UDF(float, timestamp)
Parameters
FIRST_PARAM: The
FLOATof the operation.SECOND_PARAM: The
TIMESTAMPof the operation.
Usage example
Oracle
Snowflake
Known Issues
1. Differences in time precision
When there are operations between Dates or Timestamps and Floats, the time may differ from Oracle's. There is an action item to fix this issue.
Related EWIs
MSCEWI1020: CUSTOM UDF INSERTED.
Last updated
Was this helpful?