TRUNC (number) UDF
Description
The
TRUNC
(number) function returnsn1
truncated ton2
decimal places. Ifn2
is omitted, thenn1
is truncated to 0 places.n2
can be negative to truncate (make zero)n2
digits left of the decimal point. (Oracle TRUNC(number) SQL Language Reference)
TRUNC_UDF for numeric values will be added to handle cases where the first column has an unrecognized data type.
Example:
If the definition of column1
was not provided to the tool. Then the TRUNC_UDF
will be added and in execution time, the overload of TRUNC_UDF
will handle the case if it is a numeric or a date type.
Please refer to TRUNC (DATE) section.
The following sections provide the proof that TRUNC_UDF
will handle perfectly numeric values.
Custom UDF overloads
TRUNC_UDF(n1)
It calls Snowflake TRUNC
function with the input number. This overload exists in order to handle the different types of parameter scenarios, in case that information is not available during the migration.
Parameters
INPUT: The
NUMBER
that needs to be truncated.
Oracle
Snowflake
TRUNC_UDF(n1, n2)
It calls Snowflake TRUNC
function with the input number and the scale. This overload exists in order to handle the different types of parameter scenarios, in case that information is not available during the migration.
Parameters
INPUT: The
NUMBER
that needs to be truncated.SCALE: Represents the number of digits the output will include after the decimal point.