DATEADD UDF INTERVAL

circle-info

Some parts in the output code are omitted for clarity reasons.

Description

This UDF is used to resolve operations with intervals like:

  • INTERVAL + DATE

  • INTERVAL + TIMESTAMP

  • DATE + INTERVAL

  • DATE + TIMESTAMP

  • INTERVAL + UNKNOWN

  • UNKNOWN + INTERVAL

circle-info

An UNKNOWN type is a column or expression whose type could not be resolved by Snow Convert, it use to happen when the DDLs for tables are not included in the migration or when there is an expression or subquery that can return different data types.

Custom UDF overloads

DATEADD_UDF(string, date)

Parameters

  1. INTERVAL_VALUE: The interval String of the operation.

  2. D: The DATE where the interval will be added.

DATEADD_UDF(date, string)

Parameters

  1. D: The DATE where the interval will be added.

  2. INTERVAL_VALUE: The interval String of the operation.

DATEADD_UDF(string, timestamp)

Parameters

  1. INTERVAL_VALUE: The interval String of the operation.

  2. D: The TIMESTAMP where the interval will be added.

DATEADD_UDF(timestamp, string)

Parameters

  1. D: The TIMESTAMP where the interval will be added.

  2. INTERVAL_VALUE: The interval String of the operation.

Usage example

circle-info

--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

circle-info

This configuration was used in Snowflake

Known Issues

1. INTERVAL + INTERVAL Operation is not supported

Snowflake does not support INTERVAL + INTERVAL operations.

  1. SSC-EWI-OR0036: Types resolution issues, the arithmetic operation may not behave correctly between string and date.

Last updated