User defined function was transformed to a Snowflake procedure.
This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.
Severity
Low
Description
Snowflake user defined functions do not support the same features as Oracle or SQL Server. To maintain the functional equivalence the function is transformed to a Snowflake stored procedure. This will affect their usage in queries.
Example Code
1. Scalar Return Type
Input Code:
CREATE OR REPLACE FUNCTION FUNC01(x NUMBER) RETURNNUMBERAS VAR1 NUMBER;BEGIN-- some pl sql statementsRETURN VAR1;END FUNC01;
/*** MSC-WARNING - MSCEWI1068 - USER DEFINED FUNCTION WAS TRANSFORMED TO SNOWFLAKE PROCEDURE ***/CREATE OR REPLACE PROCEDURE PUBLIC.FUNC01(x FLOAT)RETURNS FLOATLANGUAGE JAVASCRIPTEXECUTE AS CALLERAS$$/* mobilize helpers *//* pl sql statements translation */return VAR1;$$;
/*** MSC-WARNING - MSCEWI1068 - USER DEFINED FUNCTION WAS TRANSFORMED TO SNOWFLAKE PROCEDURE ***/CREATEORREPLACEPROCEDURE PURCHASING.FOO()RETURNS STRINGLANGUAGE JAVASCRIPTEXECUTEASCALLERAS$$// REGION SnowConvert Helpers Code// some implementations here...//END REGION let I =0; let P;SELECT(`COUNT(*) FROM PURCHASING.VENDOR`,[],(value) => P =value);while ( P <1000 ) { I = I +1; P = P + I; }if (I ==6) {return1; }return P;$$;