MSCEWI3050

UDF was transformed to Snowflake procedure, calling procedures inside a query is not supported.

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

This EWI is deprecated. Please see MSCEWI1067 instead.

Severity

High

Description

This error is added when a call to a UDF (user defined function) is found inside a query. Oracle UDFs and UDFs inside packages are being transformed to Snowflake Stored Procedures, which can not be called from a query.

The function is transformed to a Stored procedure to maintain functional equivalence and the function call is transformed to an empty Snowflake UDF function.

Example Code

Input Code:

Declaration

-- Create Function
CREATE OR REPLACE FUNCTION FUN1(PAR1 VARCHAR)
RETURN VARCHAR
IS
    VAR1 VARCHAR(20);
BEGIN
    SELECT COL1 INTO VAR1 FROM TABLE1 where col1 = 1;
    RETURN VAR1;
END;
/

--Function inside package
CREATE OR REPLACE PACKAGE BODY pkg1 AS
  FUNCTION f1(x NUMBER) RETURN NUMBER IS
  VAR1 NUMBER;
  BEGIN
    SELECT ID INTO VAR1 FROM TABLE1 WHERE ID = 1;
    RETURN 1;
  END f1;
END pkg1;
/

Call

CREATE VIEW VIEW1 AS SELECT FUN1(COL2) FROM TABLE1;
CREATE VIEW VIEW2 AS SELECT PKG1.F1(COL1) FROM TABLE1;

Output Code:

Call

CREATE OR REPLACE VIEW PUBLIC.VIEW1 AS SELECT
/*** MSC-ERROR - MSCEWI3050 - UDF WAS TRASFORMED TO SNOWFLAKE PROCEDURE, CALLING PROCEDURES INSIDE A QUERY IS NOT SUPPORTED ***/
PUBLIC.FUN1_UDF('FUN1(COL2)') FROM PUBLIC.TABLE1;

CREATE OR REPLACE VIEW PUBLIC.VIEW2 AS SELECT
/*** MSC-ERROR - MSCEWI3050 - UDF WAS TRASFORMED TO SNOWFLAKE PROCEDURE, CALLING PROCEDURES INSIDE A QUERY IS NOT SUPPORTED ***/
PUBLIC.PKG1.F1_UDF(COL1) FROM PUBLIC.TABLE1;

Recommendations

Last updated