TRUNC (number) UDF
Description
The
TRUNC(number) function returnsn1truncated ton2decimal places. Ifn2is omitted, thenn1is truncated to 0 places.n2can be negative to truncate (make zero)n2digits left of the decimal point. (Oracle TRUNC(number) SQL Language Reference)
TRUNC(n1 [, n2 ])TRUNC_UDF for numeric values will be added to handle cases where the first column has an unrecognized data type.
Example:
SELECT TRUNC(column1) FROM DUAL;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
NUMBERthat 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
NUMBERthat needs to be truncated.SCALE: Represents the number of digits the output will include after the decimal point.
Oracle
Snowflake
Known Issues
No issues were found.
Related EWIs
No related EWIs.
Last updated
