SSC-EWI-OR0047

TO_NCHAR transformed to TO_VARCHAR, it may not be compilable in Snowflake.

Severity

Low

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

Description

This warning is added when the function TO_NCHAR was found and it was transformed into a TO_VARCHAR function.

There are multiple cases where the transformation causes a compilation error, or the output is not the same.

Example Code

Input Code:

IN -> Oracle_01.sql
select TO_NCHAR(sysdate,'DY','nls_date_language=english') from dual

Output Code:

OUT -> Oracle_01.sql
select
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0047 - TO_NCHAR TRANSFORMED TO TO_VARCHAR, IT MAY NOT BE COMPILABLE IN SNOWFLAKE ***/!!!
TO_VARCHAR(CURRENT_TIMESTAMP(),'DY','nls_date_language=english') from dual;

The example from above will result in an error if it is used in Snowflake.

Not all cases are causing errors.

Input Code:

IN -> Oracle_02.sql
SELECT TO_NCHAR(SYSDATE, 'YYYY-MM-DD') FROM dual;

Output Code:

OUT -> Oracle_02.sql
SELECT
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0047 - TO_NCHAR TRANSFORMED TO TO_VARCHAR, IT MAY NOT BE COMPILABLE IN SNOWFLAKE ***/!!!
TO_VARCHAR(CURRENT_TIMESTAMP(), 'YYYY-MM-DD') FROM dual;

The last example does not cause an error in Snowflake, and the output is equivalent if executed.

Recommendations

Last updated