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

  1. FIRST_PARAM: The first DATE of the operation.

  2. SECOND_PARAM: The FLOAT to 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

  1. FIRST_PARAM: The FLOAT to be added.

  2. SECOND_PARAM: The DATE of the operation.

DATEADD_UDF(timestamp, float)

Parameters

  1. FIRST_PARAM: The first TIMESTAMP of the operation.

  2. SECOND_PARAM: The FLOAT to be added.

DATEADD_UDF(float, timestamp)

Parameters

  1. FIRST_PARAM: TheFLOAT of the operation.

  2. SECOND_PARAM: TheTIMESTAMP of 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.

  1. MSCEWI1020: CUSTOM UDF INSERTED.

Last updated

Was this helpful?