INTERVAL_ADD_UDF

Definition

UDFs for the subtraction when one of its values is an interval and the other is a single access which is a reference to a column of type interval.

PUBLIC.INTERVAL_ADD_UDF
(INPUT_VALUE1 VARCHAR(), INPUT_PART1 VARCHAR(30), INPUT_VALUE2 VARCHAR(), INPUT_PART2 VARCHAR(30), OP CHAR, OUTPUT_PART VARCHAR())

Parameters

INPUT_VALUE1 VARCHAR

The value to be processed.

INPUT_PART1 VARCHAR

The time type, e.g. 'HOUR'.

INPUT_VALUE2 VARCHAR

The column reference name, e.g. 'INTERVAL_HOUR_TYPE'

INPUT_PART2 VARCHAR

The type of the column referenced.

OP CHAR

The sign that is being evaluated.

OUTPUT_PART VARCHAR

The output type.

Returns

A varchar resulting from the subtraction of the intervals.

Migration example

Input:

IN -> Teradata_01.sql
CREATE TABLE INTERVAL_TABLE
(
    INTERVAL_YEAR_TYPE INTERVAL YEAR
);

SELECT INTERVAL_YEAR_TYPE - INTERVAL '7' MONTH FROM INTERVAL_TABLE;

Output:

OUT -> Teradata_01.sql
CREATE OR REPLACE TABLE INTERVAL_TABLE
(
    INTERVAL_YEAR_TYPE VARCHAR(21) !!!RESOLVE EWI!!! /*** SSC-EWI-0036 - INTERVAL YEAR DATA TYPE CONVERTED TO VARCHAR ***/!!!
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"teradata"}}'
;

SELECT
    PUBLIC.INTERVAL_ADD_UDF(INTERVAL_YEAR_TYPE, 'YEAR', '7', 'MONTH', '-', 'YEAR TO MONTH')
    FROM
    INTERVAL_TABLE;

Last updated