SnowConvert: General Issues¶
SSC-EWI-0003¶
Severity¶
Critical
Description¶
This issue appears when occurs an error executing a conversion rule for a specific SQL node
in the source code.
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0052¶
Severity¶
Medium
Description¶
This error happens when the source code uses a parameter or variable that is not supported or was not recognized by the conversion tool.
Example code¶
Input Code (Oracle):¶
-- Additional Params: -t JavaScript
CREATE OR REPLACE PROCEDURE PROCEDURE_PARAMETERS(PARAM SDO_GEOMETRY)
AS
VARIABLE SDO_GEOMETRY;
BEGIN
VARIABLE := PARAM;
END;
Output Code:¶
CREATE OR REPLACE PROCEDURE PROCEDURE_PARAMETERS (PARAM GEOMETRY)
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
// REGION SnowConvert Helpers Code
var formatDate = (arg) => (new Date(arg - (arg.getTimezoneOffset() * 60000))).toISOString().slice(0,-1);
var fixBind = function (arg) {
arg = arg instanceof Date ? formatDate(arg) : IS_NULL(arg) ? null : arg;
return arg;
};
var SQL = {
FOUND : false,
NOTFOUND : false,
ROWCOUNT : 0,
ISOPEN : false
};
var _RS, _ROWS, SQLERRM = "normal, successful completion", SQLCODE = 0;
var getObj = (_rs) => Object.assign(new Object(),_rs);
var getRow = (_rs) => (values = Object.values(_rs)) && (values = values.splice(-1 * _rs.getColumnCount())) && values;
var fetch = (_RS,_ROWS,fmode) => _RS.getRowCount() && _ROWS.next() && (fmode ? getObj : getRow)(_ROWS) || (fmode ? new Object() : []);
var EXEC = function (stmt,binds,opts) {
try {
binds = !(arguments[1] instanceof Array) && ((opts = arguments[1]) && []) || (binds || []);
opts = opts || new Object();
binds = binds ? binds.map(fixBind) : binds;
_RS = snowflake.createStatement({
sqlText : stmt,
binds : binds
});
_ROWS = _RS.execute();
if (opts.sql !== 0) {
var isSelect = stmt.toUpperCase().trimStart().startsWith("SELECT");
var affectedRows = isSelect ? _RS.getRowCount() : _RS.getNumRowsAffected();
SQL.FOUND = affectedRows != 0;
SQL.NOTFOUND = affectedRows == 0;
SQL.ROWCOUNT = affectedRows;
}
if (opts.row === 2) {
return _ROWS;
}
var INTO = function (opts) {
if (opts.vars == 1 && _RS.getColumnCount() == 1 && _ROWS.next()) {
return _ROWS.getColumnValue(1);
}
if (opts.rec instanceof Object && _ROWS.next()) {
var recordKeys = Object.keys(opts.rec);
Object.assign(opts.rec,Object.fromEntries(new Map(getRow(_ROWS).map((element,Index) => [recordKeys[Index],element]))))
return opts.rec;
}
return fetch(_RS,_ROWS,opts.row);
};
var BULK_INTO_COLLECTION = function (into) {
for(let i = 0;i < _RS.getRowCount();i++) {
FETCH_INTO_COLLECTIONS(into,fetch(_RS,_ROWS,opts.row));
}
return into;
};
if (_ROWS.getRowCount() > 0) {
return _ROWS.getRowCount() == 1 ? INTO(opts) : BULK_INTO_COLLECTION(opts);
}
} catch(error) {
RAISE(error.code,error.name,error.message)
}
};
var RAISE = function (code,name,message) {
message === undefined && ([name,message] = [message,name])
var error = new Error(message);
error.name = name
SQLERRM = `${(SQLCODE = (error.code = code))}: ${message}`
throw error;
};
var FETCH_INTO_COLLECTIONS = function (collections,fetchValues) {
for(let i = 0;i < collections.length;i++) {
collections[i].push(fetchValues[i]);
}
};
var IS_NULL = (arg) => !(arg || arg === 0);
// END REGION
let VARIABLE = new SDO_GEOMETRY();
VARIABLE =
!!!RESOLVE EWI!!! /*** SSC-EWI-0052 - UNUSABLE OBJECT PARAM, ITS DATATYPE WAS NOT TRANSFORMED ***/!!!
PARAM;
$$;
Recommendations¶
Look for an alternative for the used data type.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0066¶
Severity ¶
High
Description ¶
This error is used to inform that a specific expression is not supported in Snowflake.
Example Code ¶
Input Code:¶
SELECT * from T1 where (cast('2016-03-17' as DATE),
cast('2016-03-21' as DATE)) OVERLAPS
(cast('2016-03-20' as DATE), cast('2016-03-22' as DATE));
Output Code:¶
SELECT * from
T1
where
!!!RESOLVE EWI!!! /*** SSC-EWI-0066 - EXPRESSION 'OVERLAPS' IS NOT SUPPORTED IN SNOWFLAKE. ***/!!! (cast('2016-03-17' as DATE),
cast('2016-03-21' as DATE)) OVERLAPS
(cast('2016-03-20' as DATE), cast('2016-03-22' as DATE));
Recommendations ¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0027¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Medium
Description¶
This warning is used to report that a specific statement uses a variable or literal with an invalid query and for that reason, it will not be executed.
Example Code¶
Input Code:¶
REPLACE PROCEDURE TEST.COLLECT_STATS ()
BEGIN
COLLECT STATS ON DBC.AccessRights COLUMN(COLNAME);
SET STATS_STATEMENT = 'COLLECT STATS ON ' || OUT_DB || '.' || OUT_TBL || ' COLUMN(' || C4.ColumnName || ');';
EXECUTE IMMEDIATE STATS_STATEMENT;
EXECUTE IMMEDIATE 'COLLECT STATS ON DBC.AccessRights COLUMN(COLNAME);';
SET STATS_STATEMENT_NOT_DYNAMIC = 'COLLECT STATS ON DBC.AccessRights COLUMN(COLNAME);';
EXECUTE IMMEDIATE STATS_STATEMENT_NOT_DYNAMIC;
END;
;
Output Code:¶
CREATE OR REPLACE PROCEDURE TEST.COLLECT_STATS ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"teradata"}}'
EXECUTE AS CALLER
AS
$$
BEGIN
-- --** SSC-FDM-0027 - REMOVED NEXT STATEMENT, NOT APPLICABLE IN SNOWFLAKE. COLLECT **
-- COLLECT STATS ON DBC.AccessRights COLUMN(COLNAME);
STATS_STATEMENT := 'COLLECT STATS ON ' || OUT_DB || '.' || OUT_TBL || ' COLUMN(' || C4.ColumnName || ')';
!!!RESOLVE EWI!!! /*** SSC-EWI-0027 - THE FOLLOWING STATEMENT USES A VARIABLE/LITERAL WITH AN INVALID QUERY AND IT WILL NOT BE EXECUTED ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE STATS_STATEMENT;
!!!RESOLVE EWI!!! /*** SSC-EWI-0027 - THE FOLLOWING STATEMENT USES A VARIABLE/LITERAL WITH AN INVALID QUERY AND IT WILL NOT BE EXECUTED ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE 'COLLECT STATS ON DBC.AccessRights COLUMN(COLNAME)';
STATS_STATEMENT_NOT_DYNAMIC := 'COLLECT STATS ON DBC.AccessRights COLUMN(COLNAME)';
!!!RESOLVE EWI!!! /*** SSC-EWI-0027 - THE FOLLOWING STATEMENT USES A VARIABLE/LITERAL WITH AN INVALID QUERY AND IT WILL NOT BE EXECUTED ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE STATS_STATEMENT_NOT_DYNAMIC;
END;
$$;
Recommendations¶
Check if a cast to a Date, Time, or Timestamp is necessary for the binding. Some cases are not necessary because an implicit conversion is done to the value.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0102¶
Severity¶
Low
Description¶
Snowflake statements could remove some options when they are handled by the conversion rule. So it will be removed from the output code but the functionality is equivalent.
Example code¶
Input Code (PostgreSQL):¶
-- Case 1:
TRUNCATE ONLY table_base2 RESTART IDENTITY CASCADE;
-- Case 2:
TRUNCATE TABLE table_inherit_and_generated RESTART IDENTITY CASCADE;
Output Code:¶
-- Case 1:
!!!RESOLVE EWI!!! /*** SSC-EWI-0102 - REMOVED ONLY OPTION FROM CODE, ALREADY HANDLED IN CONVERSION TO SNOWFLAKE ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0102 - REMOVED CASCADE OPTION FROM CODE, ALREADY HANDLED IN CONVERSION TO SNOWFLAKE ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0102 - REMOVED RESTART IDENTITY OPTION FROM CODE, ALREADY HANDLED IN CONVERSION TO SNOWFLAKE ***/!!!
TRUNCATE table_base2;
-- Case 2:
!!!RESOLVE EWI!!! /*** SSC-EWI-0102 - REMOVED CASCADE OPTION FROM CODE, ALREADY HANDLED IN CONVERSION TO SNOWFLAKE ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0102 - REMOVED RESTART IDENTITY OPTION FROM CODE, ALREADY HANDLED IN CONVERSION TO SNOWFLAKE ***/!!!
TRUNCATE TABLE table_inherit_and_generated;
Recommendations¶
No end-user action is required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0013¶
Severity¶
Critical
Description¶
This error appears when an exception is raised while converting an item from the source code.
Recommendation¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0033¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Low
Description¶
This warning appears when a column used in a CAST function with a specific output format was not found in the source code.
Example Code¶
Input Code (Teradata):¶
CREATE VIEW SampleView AS
SELECT
DAY_DATE(FORMAT 'MMM-YYYY')(CHAR(8))
FROM
SampleTable;
Output Code:¶
// SnowConvert Helpers Code section is omitted.
CREATE OR REPLACE VIEW SampleView
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"teradata"}}'
AS
SELECT
CAST(RPAD(TO_VARCHAR(
DAY_DATE !!!RESOLVE EWI!!! /*** SSC-EWI-0033 - FORMAT 'MMM-YYYY' REMOVED, SEMANTIC INFORMATION NOT FOUND. ***/!!!), 8) AS CHAR(8))
FROM
SampleTable;
Recommendations¶
Make sure all the dependencies(tables and views) related to the procedure statement are being migrated.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0062¶
Severity¶
Low
Description¶
This message appears when a Custom Type is referenced, and then its usage is changed to a variant.
This message is heavily related to SSC-EWI-0056.
Example code¶
Input Code (Oracle):¶
CREATE TYPE type1 AS OBJECT(type1_column1 INT);
CREATE TABLE table1
(
column1 type1
);
Output Code:¶
!!!RESOLVE EWI!!! /*** SSC-EWI-0056 - CUSTOM TYPES ARE NOT SUPPORTED IN SNOWFLAKE BUT REFERENCES TO THIS CUSTOM TYPE WERE CHANGED TO VARIANT ***/!!!
CREATE TYPE type1 AS OBJECT(type1_column1 INT)
;
CREATE OR REPLACE TABLE table1
(
column1 VARIANT !!!RESOLVE EWI!!! /*** SSC-EWI-0062 - CUSTOM TYPE 'type1' USAGE CHANGED TO VARIANT ***/!!!
)
<strong>COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
</strong>;
CREATE OR REPLACE VIEW PUBLIC.table1_view
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "oracle", "convertedOn": "" }}'
AS
SELECT
column1:type1_column1 :: INTEGER AS type1_column1
FROM
table1;
Recommendations¶
Remember to transform all of its input data into a Variant-compliant data type as well.
If you need more support, you can email us at snowconvert-support@snowflake.com.
SSC-EWI-0056¶
Severity¶
Low
Description¶
This message appears when a transformable Custom Type is defined, to add feedback about the transformable Custom Types being commented.
The type definition is commented on but is still being taken into account for resolving usages, see SSC-EWI-0062 for more information.
Example code¶
Input Code (Oracle):¶
CREATE TYPE type1 AS OBJECT (column1 INT);
CREATE OR REPLACE PROCEDURE record_procedure
IS
TYPE record_typ IS RECORD(col1 INTEGER, col2 FLOAT);
BEGIN
NULL;
END;
Output Code:¶
!!!RESOLVE EWI!!! /*** SSC-EWI-0056 - CUSTOM TYPES ARE NOT SUPPORTED IN SNOWFLAKE BUT REFERENCES TO THIS CUSTOM TYPE WERE CHANGED TO VARIANT ***/!!!
CREATE TYPE type1 AS OBJECT (column1 INT)
;
CREATE OR REPLACE PROCEDURE record_procedure ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
!!!RESOLVE EWI!!! /*** SSC-EWI-0056 - CUSTOM TYPES ARE NOT SUPPORTED IN SNOWFLAKE BUT REFERENCES TO THIS CUSTOM TYPE WERE CHANGED TO OBJECT ***/!!!
TYPE record_typ IS RECORD(col1 INTEGER, col2 FLOAT);
BEGIN
NULL;
END;
$$;
Recommendations¶
No end user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0007¶
Severity¶
Critical
Description¶
This error appears when occurs an error in writing the output file.
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0046¶
Severity¶
Critical
Description¶
Snowflake does not support the declaration of nested functions/procedures, this warning is added to any create function or create procedure statement in which nested declarations were found.
Code example¶
Input¶
CREATE OR REPLACE FUNCTION myFunction
RETURN INTEGER
IS
total_count INTEGER;
-- Function Declaration
FUNCTION function_declaration(param1 VARCHAR) RETURN INTEGER;
FUNCTION function_definition
RETURN INTEGER
IS
count INTEGER;
PROCEDURE procedure_declaration(param1 INTEGER)
IS
BEGIN
NULL;
END;
BEGIN
RETURN count;
end;
BEGIN
-- Your logic to calculate the total employee count goes here
RETURN total_count;
END;
Output¶
!!!RESOLVE EWI!!! /*** SSC-EWI-0046 - NESTED FUNCTION/PROCEDURE DECLARATIONS ARE NOT SUPPORTED IN SNOWFLAKE. ***/!!!
CREATE OR REPLACE FUNCTION myFunction ()
RETURNS FLOAT
LANGUAGE JAVASCRIPT
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "oracle", "convertedOn": "12/16/2024", "domain": "test" }}'
AS
$$
let TOTAL_COUNT;
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0057 - TRANSFORMATION FOR NESTED PROCEDURE OR FUNCTION IS NOT SUPPORTED ***/!!!
/* -- Function Declaration
FUNCTION function_declaration(param1 VARCHAR) RETURN INTEGER; */
// Function Declaration
;
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0057 - TRANSFORMATION FOR NESTED PROCEDURE OR FUNCTION IS NOT SUPPORTED ***/!!!
/* FUNCTION function_definition
RETURN INTEGER
IS
count INTEGER;
PROCEDURE procedure_declaration(param1 INTEGER)
IS
BEGIN
NULL;
END;
BEGIN
RETURN count;
end; */
;
// Your logic to calculate the total employee count goes here
return TOTAL_COUNT;
$$;
Recommendations¶
Remove the nested declarations from the function/procedure.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0023¶
The EWI is only generated when Javascript is the target language for Stored Procedures. This is a deprecated translation feature, as Snowflake Scripting is the recommended target language for Stored Procedures.
Some parts in the output code are omitted for clarity reasons.
Severity¶
Low
Description¶
This warning indicates a possible consideration that the user should have in terms of performance.
Example Code¶
Input Code:¶
-- Additional Params: -t javascript
REPLACE PROCEDURE Database1.Proc1()
BEGIN
DECLARE lNumber INTEGER DEFAULT 1;
FOR class1 AS class2 CURSOR FOR
SELECT COL0,
TRIM(COL1) AS COL1ALIAS,
TRIM(COL2),
COL3
FROM someDb.prefixCol
DO
INSERT INTO TempDB.Table1 (:lgNumber, :lNumber, (',' || :class1.ClassCD || '_Ind CHAR(1) NOT NULL'));
SET lNumber = lNumber + 1;
END FOR;
END;
Output Code:¶
CREATE OR REPLACE PROCEDURE Database1.Proc1 ()
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"teradata"}}'
EXECUTE AS CALLER
AS
$$
// SnowConvert Helpers Code section is omitted.
var LNUMBER = 1;
/*** SSC-EWI-0023 - PERFORMANCE REVIEW - THIS LOOP CONTAINS AN INSERT, DELETE OR UPDATE STATEMENT ***/
for(var CLASS2 = new CURSOR(`SELECT
COL0,
TRIM(COL1) AS COL1ALIAS,
TRIM(COL2),
COL3
FROM
someDb.prefixCol`,[],false).OPEN();CLASS2.NEXT();) {
let CLASS1 = CLASS2.CURRENT;
EXEC(`INSERT INTO TempDB.Table1
VALUES (:lgNumber, :1, (',' || :
!!!RESOLVE EWI!!! /*** SSC-EWI-0026 - THE VARIABLE class1.ClassCD MAY REQUIRE A CAST TO DATE, TIME OR TIMESTAMP ***/!!!
:2 || '_Ind CHAR(1) NOT NULL'))`,[LNUMBER,CLASS1.CLASSCD]);
LNUMBER = LNUMBER + 1;
}
CLASS2.CLOSE();
$$;
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0107¶
Severity¶
High
Description¶
Snowflake Intervals can only be used in arithmetic operations. Intervals used in any other scenario are not supported.
Example Code ¶
Input Code:
SELECT INTERVAL '1-5' YEAR TO MONTH FROM DUAL;
Output Code:
SELECT
!!!RESOLVE EWI!!! /*** SSC-EWI-0107 - INTERVAL LITERAL IS NOT SUPPORTED BY SNOWFLAKE IN THIS SCENARIO ***/!!!
INTERVAL '1-5' YEAR TO MONTH FROM DUAL;
Recommendations ¶
No end-user action is required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0073¶
Severity¶
Medium
Description¶
This EWI is added when there is a grammar clause in the input platform that has not been reviewed yet by the SnowConvert developer team, in order to provide support for it in Snowflake. That means the code has not been transformed in any way and therefore, is something that may not work in Snowflake without some manual revision.
Example Code¶
SQLServer:¶
CREATE OR ALTER PROC SampleProcedure
AS
BEGIN
INSERT INTO aTable (columnA = 'varcharValue', columnB = 1);
INSERT exampleTable VALUES ('Hello', 23);
INSERT INTO exampleTable DEFAULT VALUES;
END
CREATE OR REPLACE PROCEDURE SampleProcedure ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}'
EXECUTE AS CALLER
AS
$$
BEGIN
INSERT INTO aTable (columnA = 'varcharValue', columnB = 1);
INSERT INTO exampleTable VALUES ('Hello', 23);
!!!RESOLVE EWI!!! /*** SSC-EWI-0073 - PENDING FUNCTIONAL EQUIVALENCE REVIEW FOR 'INSERT WITH DEFAULT VALUES' NODE ***/!!!
INSERT INTO exampleTable DEFAULT VALUES;
END;
$$;
Notice in line 6 of the input code, that there is a reference to a INSERT
statement with DEFAULT VALUES
, this is currently a not supported statement by SnowConvert and that is why in lines 11 and 12 the EWI is generated.
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0022¶
The EWI is only generated when Javascript is the target language for Stored Procedures. This is a deprecated translation feature, as Snowflake Scripting is the recommended target language for Stored Procedures.
Some parts in the output code are omitted for clarity reasons.
Severity¶
Medium
Description¶
This error is used to report that one or more identifiers in a specific statement are considered parameters by default.
Example Code¶
Input Code:¶
-- Additional Params: -t javascript
CREATE MACRO SAME_MACRO_COLUMN_AND_PARAMATERS (
LOAD_USER_ID (VARCHAR (32), CHARACTER SET LATIN),
UPDATE_USER_ID (VARCHAR (32), CHARACTER SET LATIN)
) AS (
UPDATE TABLE1 SET LOAD_USER_ID = :LOAD_USER_ID, UPDATE_USER_ID = :UPDATE_USER_ID;
INSERT INTO TABLE1 (LOAD_USER_ID, UPDATE_USER_ID) VALUES (:LOAD_USER_ID, :UPDATE_USER_ID);
DELETE FROM TABLE1 WHERE :LOAD_USER_ID = LOAD_USER_ID;
);
Output Code:¶
CREATE OR REPLACE PROCEDURE SAME_MACRO_COLUMN_AND_PARAMATERS (LOAD_USER_ID VARCHAR (32), UPDATE_USER_ID VARCHAR (32))
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "teradata", "convertedOn": "12/16/2024", "domain": "test" }}'
EXECUTE AS CALLER
AS
$$
// SnowConvert Helpers Code section is omitted.
EXEC(`UPDATE TABLE1
SET
LOAD_USER_ID = :1,
UPDATE_USER_ID = :2`,[LOAD_USER_ID,UPDATE_USER_ID]);
// ** SSC-EWI-0022 - ONE OR MORE IDENTIFIERS IN THIS STATEMENT WERE CONSIDERED PARAMETERS BY DEFAULT. REFERENCED TABLE NOT FOUND. **
EXEC(`INSERT INTO TABLE1 (LOAD_USER_ID, UPDATE_USER_ID)
VALUES (:1, :2)`,[LOAD_USER_ID,UPDATE_USER_ID]);
!!!RESOLVE EWI!!! /*** SSC-EWI-0073 - PENDING FUNCTIONAL EQUIVALENCE REVIEW FOR 'Delete' NODE ***/!!!
//DELETE FROM
// TABLE1
//WHERE
// RTRIM(:LOAD_USER_ID) = RTRIM(LOAD_USER_ID)
null
$$;
Recommendations¶
Make sure all the dependencies(tables and views) related to the procedure statement are being migrated.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0080¶
Severity ¶
Low
Description ¶
This EWI is added when the source code has a default value for BINARY data type, which is not supported in SnowFlake SQL
Example Code ¶
Input Code (SqlServer):
create table test1345
(
key1 binary default 0
);
Output Code:
CREATE OR REPLACE TABLE test1345
(
key1 BINARY
!!!RESOLVE EWI!!! /*** SSC-EWI-0080 - DEFAULT VALUE IS NOT ALLOWED ON BINARY COLUMNS ***/!!!
default 0
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}'
;
Recommendations ¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0002¶
Severity¶
Medium
Description¶
Default parameters may need to be reordered. Snowflake only supports default parameters at the end of the parameter declarations.
Example Code¶
Input Code:¶
CREATE PROCEDURE MySampleProc
@Param1 NVARCHAR(50) = NULL,
@Param2 NVARCHAR(10),
@Param3 NVARCHAR(10) = NULL,
@Param4 NVARCHAR(10)
AS
SELECT 1;
Output Code:¶
CREATE OR REPLACE PROCEDURE MySampleProc
!!!RESOLVE EWI!!! /*** SSC-EWI-0002 - DEFAULT PARAMETERS MAY NEED TO BE REORDERED. SNOWFLAKE ONLY SUPPORTS DEFAULT PARAMETERS AT THE END OF THE PARAMETERS DECLARATIONS ***/!!!
(PARAM1 STRING DEFAULT NULL, PARAM2 STRING, PARAM3 STRING DEFAULT NULL, PARAM4 STRING)
RETURNS TABLE()
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
ProcedureResultSet RESULTSET;
BEGIN
ProcedureResultSet := (
SELECT 1);
RETURN TABLE(ProcedureResultSet);
END;
$$;
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0053¶
Severity¶
Low
Description¶
This error happens when the conversion tool could not determine the data type of a variable. This may happen because the declaration of a variable could be missing.
Example code¶
Input Code (Oracle):¶
-- Additional Params: -t javascript
CREATE OR REPLACE PROCEDURE PROCEDURE_VARIABLES
AS
VARIABLE INTEGER;
BEGIN
VARIABLE := ANOTHER_VARIABLE;
END;
Output Code:¶
CREATE OR REPLACE PROCEDURE PROCEDURE_VARIABLES ()
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
// REGION SnowConvert Helpers Code
var formatDate = (arg) => (new Date(arg - (arg.getTimezoneOffset() * 60000))).toISOString().slice(0,-1);
var fixBind = function (arg) {
arg = arg instanceof Date ? formatDate(arg) : IS_NULL(arg) ? null : arg;
return arg;
};
var SQL = {
FOUND : false,
NOTFOUND : false,
ROWCOUNT : 0,
ISOPEN : false
};
var _RS, _ROWS, SQLERRM = "normal, successful completion", SQLCODE = 0;
var getObj = (_rs) => Object.assign(new Object(),_rs);
var getRow = (_rs) => (values = Object.values(_rs)) && (values = values.splice(-1 * _rs.getColumnCount())) && values;
var fetch = (_RS,_ROWS,fmode) => _RS.getRowCount() && _ROWS.next() && (fmode ? getObj : getRow)(_ROWS) || (fmode ? new Object() : []);
var EXEC = function (stmt,binds,opts) {
try {
binds = !(arguments[1] instanceof Array) && ((opts = arguments[1]) && []) || (binds || []);
opts = opts || new Object();
binds = binds ? binds.map(fixBind) : binds;
_RS = snowflake.createStatement({
sqlText : stmt,
binds : binds
});
_ROWS = _RS.execute();
if (opts.sql !== 0) {
var isSelect = stmt.toUpperCase().trimStart().startsWith("SELECT");
var affectedRows = isSelect ? _RS.getRowCount() : _RS.getNumRowsAffected();
SQL.FOUND = affectedRows != 0;
SQL.NOTFOUND = affectedRows == 0;
SQL.ROWCOUNT = affectedRows;
}
if (opts.row === 2) {
return _ROWS;
}
var INTO = function (opts) {
if (opts.vars == 1 && _RS.getColumnCount() == 1 && _ROWS.next()) {
return _ROWS.getColumnValue(1);
}
if (opts.rec instanceof Object && _ROWS.next()) {
var recordKeys = Object.keys(opts.rec);
Object.assign(opts.rec,Object.fromEntries(new Map(getRow(_ROWS).map((element,Index) => [recordKeys[Index],element]))))
return opts.rec;
}
return fetch(_RS,_ROWS,opts.row);
};
var BULK_INTO_COLLECTION = function (into) {
for(let i = 0;i < _RS.getRowCount();i++) {
FETCH_INTO_COLLECTIONS(into,fetch(_RS,_ROWS,opts.row));
}
return into;
};
if (_ROWS.getRowCount() > 0) {
return _ROWS.getRowCount() == 1 ? INTO(opts) : BULK_INTO_COLLECTION(opts);
}
} catch(error) {
RAISE(error.code,error.name,error.message)
}
};
var RAISE = function (code,name,message) {
message === undefined && ([name,message] = [message,name])
var error = new Error(message);
error.name = name
SQLERRM = `${(SQLCODE = (error.code = code))}: ${message}`
throw error;
};
var FETCH_INTO_COLLECTIONS = function (collections,fetchValues) {
for(let i = 0;i < collections.length;i++) {
collections[i].push(fetchValues[i]);
}
};
var IS_NULL = (arg) => !(arg || arg === 0);
// END REGION
let VARIABLE;
VARIABLE =
!!!RESOLVE EWI!!! /*** SSC-EWI-0053 - OBJECT ANOTHER_VARIABLE MAY NOT WORK PROPERLY, ITS DATATYPE WAS NOT RECOGNIZED ***/!!!
ANOTHER_VARIABLE;
$$;
Recommendations¶
Make sure the input code has the variable declared.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0094¶
Severity¶
Low
Description¶
Currently there is no equivalent for labels declaration in Snow Scripting, so an EWI is added, and the label is commented out
Example Code¶
Input Code (Oracle):¶
CREATE OR REPLACE PROCEDURE Example ( grade NUMBER )
IS
BEGIN
<<CASE1>><<CASE2>>
CASE grade
WHEN 10 THEN NULL;
ELSE NULL;
END CASE CASE1;
END;
Output Code:¶
CREATE OR REPLACE PROCEDURE Example (grade NUMBER(38, 18))
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
BEGIN
!!!RESOLVE EWI!!! /*** SSC-EWI-0094 - LABEL DECLARATION FOR A STATEMENT IS NOT SUPPORTED BY SNOWFLAKE SCRIPTING <<CASE1>><<CASE2>> ***/!!!
CASE :grade
WHEN 10 THEN
NULL;
ELSE NULL;
END CASE;
END;
$$;
Recommendations¶
No end-user action is required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0067¶
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 and some SQL Server UDFs, 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.
This EWI is strongly related to SSC-EWI-0068
Example Code¶
SQL Server:¶
CREATE OR ALTER FUNCTION PURCHASING.FOO()
RETURNS INT
AS
BEGIN
DECLARE @i int = 0, @p int;
Select @p = COUNT(*) FROM PURCHASING.VENDOR
WHILE (@p < 1000)
BEGIN
SET @i = @i + 1
SET @p = @p + @i
END
IF (@i = 6)
RETURN 1
RETURN @p
END;
GO
SELECT PURCHASING.FOO() AS RESULT;
--** SSC-FDM-0029 - USER DEFINED FUNCTION WAS TRANSFORMED TO SNOWFLAKE PROCEDURE **
CREATE OR REPLACE PROCEDURE PURCHASING.FOO ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
I INT := 0;
P INT;
BEGIN
Select
COUNT(*)
INTO
:P
FROM
PURCHASING.VENDOR;
WHILE (:P < 1000) LOOP
I := :I + 1;
P := :P + :I;
END LOOP;
IF ((:I = 6)) THEN
RETURN 1;
END IF;
RETURN :P;
END;
$$;
SELECT
PURCHASING.FOO() !!!RESOLVE EWI!!! /*** SSC-EWI-0067 - UDF WAS TRANSFORMED TO SNOWFLAKE PROCEDURE, CALLING PROCEDURES INSIDE QUERIES IS NOT SUPPORTED ***/!!! AS RESULT;
Oracle:¶
CREATE FUNCTION employee_function (param1 in NUMBER) RETURN NUMBER is
var1 employees.employee_ID%TYPE;
var2 employees.manager_ID%TYPE;
var3 employees.title%TYPE;
BEGIN
SELECT employee_ID, manager_ID, title
INTO var1, var2, var3
FROM employees
START WITH manager_ID = param1
CONNECT BY manager_ID = PRIOR employee_id;
RETURN var1;
EXCEPTION
WHEN no_data_found THEN RETURN param1;
END employee_function;
SELECT employee_function(2) FROM employees;
--** SSC-FDM-0029 - USER DEFINED FUNCTION WAS TRANSFORMED TO SNOWFLAKE PROCEDURE **
CREATE OR REPLACE PROCEDURE employee_function (param1 NUMBER(38, 18))
RETURNS NUMBER(38, 18)
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "oracle", "convertedOn": "11/14/2024", "domain": "test" }}'
EXECUTE AS CALLER
AS
$$
DECLARE
var1 employees.employee_ID%TYPE;
var2 employees.manager_ID%TYPE;
var3 employees.title%TYPE;
BEGIN
SELECT employee_ID, manager_ID, title
INTO
:var1,
:var2,
:var3
FROM
employees
START WITH manager_ID = :param1
CONNECT BY
manager_ID = PRIOR employee_id;
RETURN :var1;
EXCEPTION
WHEN no_data_found THEN
RETURN :param1;
END;
$$;
SELECT
!!!RESOLVE EWI!!! /*** SSC-EWI-0067 - UDF WAS TRANSFORMED TO SNOWFLAKE PROCEDURE, CALLING PROCEDURES INSIDE QUERIES IS NOT SUPPORTED ***/!!! employee_function(2) FROM
employees;
Recommendations¶
The source code may need to be restructured to fit with the Snowflake user-defined functions approach.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0036¶
Severity¶
Low
Description¶
This warning appears when a data type is changed into another one.
Example Code¶
Source Code:¶
CREATE TABLE SampleTable (
SampleYear INTERVAL YEAR(2),
SampleMonth INTERVAL MONTH(2)
);
Converted Code:¶
CREATE OR REPLACE TABLE SampleTable (
SampleYear VARCHAR(21) !!!RESOLVE EWI!!! /*** SSC-EWI-0036 - INTERVAL YEAR(2) DATA TYPE CONVERTED TO VARCHAR ***/!!!,
SampleMonth VARCHAR(21) !!!RESOLVE EWI!!! /*** SSC-EWI-0036 - INTERVAL MONTH(2) DATA TYPE CONVERTED TO VARCHAR ***/!!!
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "teradata", "convertedOn": "07/23/2024" }}'
;
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0026¶
The EWI is only generated when Javascript is the target language for Stored Procedures. This is a deprecated translation feature, as Snowflake Scripting is the recommended target language for Stored Procedures.
Some parts in the output code are omitted for clarity reasons.
Severity¶
Low
Description¶
This warning is added when there is a query with a variable with a qualified member like an Oracle record or a Teradata for loop variable. Depending on where the variable is being used and the type of value, a cast may be necessary to work properly.
Example Code¶
Input Code:¶
CREATE TABLE TABLE1 (COL1 DATE);
CREATE TABLE TABLE2 (COL1 VARCHAR(25));
CREATE OR REPLACE PROCEDURE EXAMPLE
IS
CURSOR C1 IS SELECT * FROM TABLE1;
BEGIN
FOR REC1 IN C1 LOOP
insert into TABLE2 values (TO_CHAR(REC1.COL1, 'DD-MM-YYYY'));
END LOOP;
END;
Output Code:¶
-- Additional Params: -t javascript
CREATE OR REPLACE TABLE TABLE1 (COL1 TIMESTAMP /*** SSC-FDM-OR0042 - DATE TYPE COLUMN HAS A DIFFERENT BEHAVIOR IN SNOWFLAKE. ***/
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
;
CREATE OR REPLACE TABLE TABLE2 (COL1 VARCHAR(25))
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
;
CREATE OR REPLACE PROCEDURE EXAMPLE ()
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
// SnowConvert Helpers Code section is omitted.
let C1 = new CURSOR(`SELECT * FROM
TABLE1`,() => []);
C1.OPEN();
// ** SSC-EWI-0023 - PERFORMANCE REVIEW - THIS LOOP CONTAINS AN INSERT, DELETE OR UPDATE STATEMENT **
while ( C1.NEXT() ) {
let REC1 = C1.CURRENT;
EXEC(`insert into TABLE2
values (TO_CHAR(
!!!RESOLVE EWI!!! /*** SSC-EWI-0026 - THE VARIABLE REC1.COL1 MAY REQUIRE A CAST TO DATE, TIME OR TIMESTAMP ***/!!!
?, 'DD-MM-YYYY'))`,[REC1.COL1]);
}
C1.CLOSE();
$$;
Output Code with adjustments:¶
CREATE OR REPLACE TABLE TABLE1 (COL1 TIMESTAMP
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
;
CREATE OR REPLACE TABLE TABLE2 (COL1 VARCHAR(25))
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
;
CREATE OR REPLACE PROCEDURE EXAMPLE ()
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
// SnowConvert Helpers Code section is omitted.
let C1 = new CURSOR(`SELECT * FROM
TABLE1`,() => []);
C1.OPEN();
// ** SSC-EWI-0023 - PERFORMANCE REVIEW - THIS LOOP CONTAINS AN INSERT, DELETE OR UPDATE STATEMENT **
while ( C1.NEXT() ) {
let REC1 = C1.CURRENT;
EXEC(`insert into TABLE2
values (TO_CHAR(REC1.COL1::DATE, 'DD-MM-YYYY'))`,[REC1.COL1]);
}
C1.CLOSE();
$$;
Recommendations¶
Check if a cast to a Date, Time, or Timestamp is necessary for the binding. Some cases are not necessary because an implicit conversion is done to the value.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0077¶
Severity¶
Low
Description¶
This warning is added when a query that has several CTE (Common Table Expression) reference calls creates a cycle that cannot determine the calling order of the CTEs, and then the CTEs cannot be ordered and the query will remain as the source.
Example Code¶
Input Code (Teradata):¶
WITH t1(c1) as (SELECT c1 FROM t2),
t2(c2) as (SELECT c2 FROM t3),
RECURSIVE t3(c3) as (SELECT c3, someOtherColumn FROM t1, t3)
SELECT * FROM t1;
Output Code:¶
!!!RESOLVE EWI!!! /*** SSC-EWI-0077 - CYCLE FOUND BETWEEN CTE REFERENCE CALLS, CTES CANNOT BE ORDERED AND THE QUERY WILL REMAIN AS ORIGINAL ***/!!!
WITH RECURSIVE t1(c1) AS
(
SELECT
c1 FROM t2
),
t2(c2) AS
(
SELECT
c2 FROM t3
),
t3(c3) AS
(
SELECT
c3,
someOtherColumn FROM t1, t3
)
SELECT
* FROM t1;
Recommendations¶
No additional user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0084¶
Severity¶
High
Description¶
XMLTABLE function is not currently supported.
Example Code¶
Input Code (DB2):¶
SELECT
*
FROM
XMLTABLE(
'stringValue' PASSING BY REF passingExpr AS AliasName
) AS XMLTABLENAME
Output Code:¶
SELECT
*
FROM
!!!RESOLVE EWI!!! /*** SSC-EWI-0084 - XMLTABLE IS NOT SUPPORTED BY SNOWFLAKE ***/!!!
XMLTABLE(
'stringValue' PASSING BY REF passingExpr AS AliasName
) AS XMLTABLENAME
Recommendations¶
Check this blog for XML transformations in Snowflake.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0012¶
Severity¶
High
Description¶
This error appears when there is an unexpected end of the statement in the source code
Example Code¶
Input Code:¶
CREATE VOLATILE SET TABLE VOLATILETABLE
(
COL1 INTEGER,
COL2 INTEGER,
COL3 INTEGER
)
ON COMMIT PRESERVE ROWS;
UPDATE TABLE2 as T2
SET T2.COL1 + VOLATILETABLE.COL1
WHERE T2.COL2 = VOLATILETABLE.COL2
AND T2.COL3 = VOLATILETABLE.COL3
AND T2.COL4 = ( SELECT MAX(T3.COL1)
FROM
TABLE3 T3
WHERE T3.COL1 = T2.COL1);
Output Code:¶
--** SSC-FDM-TD0024 - SET TABLE FUNCTIONALITY NOT SUPPORTED. TABLE MIGHT HAVE DUPLICATE ROWS **
CREATE OR REPLACE TEMPORARY TABLE VOLATILETABLE
(
COL1 INTEGER,
COL2 INTEGER,
COL3 INTEGER
)
-- --** SSC-FDM-0008 - ON COMMIT NOT SUPPORTED **
--ON COMMIT PRESERVE ROWS
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"teradata"}}'
;
--** SSC-FDM-0007 - MISSING DEPENDENT OBJECTS "TABLE2", "TABLE3" **
UPDATE TABLE2 AS T2
SET
--** SSC-FDM-0025 - UNEXPECTED END OF STATEMENT. PLEASE CHECK THE LINE 9 OF ORIGINAL SOURCE CODE. **
T2.COL1 + VOLATILETABLE.COL1
FROM
VOLATILETABLE
WHERE T2.COL2 = _VOLATILETABLE.COL2
AND T2.COL3 = _VOLATILETABLE.COL3
AND T2.COL4 = (
SELECT
MAX(T3.COL1)
FROM
TABLE3 T3
WHERE T3.COL1 = T2.COL1);
Recommendation¶
Check if the source code is incomplete or if the statement that is being converted ends correctly.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0058¶
Severity¶
Medium
Description¶
This error happens when a statement used in a create procedure is not currently supported by Snowflake Scripting.
Example code¶
Input Code (Oracle):¶
CREATE OR REPLACE PROCEDURE PROC01
IS
number_variable INTEGER;
BEGIN
EXECUTE IMMEDIATE 'SELECT 1 FROM DUAL' INTO number_variable;
END;
Output Code:¶
CREATE OR REPLACE PROCEDURE PROC01 ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
number_variable INTEGER;
BEGIN
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE 'SELECT 1 FROM DUAL'
!!!RESOLVE EWI!!! /*** SSC-EWI-0058 - FUNCTIONALITY FOR 'EXECUTE IMMEDIATE RETURNING CLAUSE' IS NOT CURRENTLY SUPPORTED BY SNOWFLAKE SCRIPTING ***/!!!
INTO number_variable;
END;
$$;
Recommendations¶
No end-user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0108¶
Severity¶
High
Description¶
In Snowflake, there are multiple patterns and elements in a subquery that are not supported and make it not executable. According to the Snowflake documentation on subqueries the following subquery types are supported:
Uncorrelated scalar subqueries in any place that a value expression can be used.
Correlated scalar subqueries in WHERE clauses.
EXISTS, ANY / ALL, and IN subqueries in WHERE clauses. These subqueries can be correlated or uncorrelated.
Please note that the list above is not exhaustive, meaning that subqueries that match none of the specified types may still be considered valid.
To help avoid errors, SnowConvert knows a set of subquery patterns that normally invalidate subqueries, this EWI is added to warn the user that the subquery matches at least one of these patterns and therefore may produce errors when compiled in Snowflake.
Example Code¶
Input Code:¶
CREATE TABLE tableA
(
col1 INTEGER,
col2 VARCHAR(20)
);
CREATE TABLE tableB
(
col3 INTEGER,
col4 VARCHAR(20)
);
INSERT INTO tableA VALUES (50, 'Hey');
INSERT INTO tableB VALUES (50, 'Hey');
INSERT INTO tableB VALUES (50, 'Example');
INSERT INTO tableB VALUES (10, 'Bye');
-- Snowflake only allows the usage of FETCH in subqueries that are uncorrelated scalar, this subquery execution will fail
SELECT col2
FROM tableA
WHERE col2 = (SELECT col4 FROM tableB WHERE col3 = col1 FETCH FIRST ROW ONLY);
-- This subquery is uncorrelated scalar so FETCH is valid to use
SELECT col2
FROM tableA
WHERE col2 = (SELECT col4 FROM tableB FETCH FIRST ROW ONLY);
Output Code:¶
CREATE OR REPLACE TABLE tableA
(
col1 INTEGER,
col2 VARCHAR(20)
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "oracle", "convertedOn": "12/05/2024", "domain": "test" }}'
;
CREATE OR REPLACE TABLE tableB
(
col3 INTEGER,
col4 VARCHAR(20)
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "oracle", "convertedOn": "12/05/2024", "domain": "test" }}'
;
INSERT INTO tableA
VALUES (50, 'Hey');
INSERT INTO tableB
VALUES (50, 'Hey');
INSERT INTO tableB
VALUES (50, 'Example');
INSERT INTO tableB
VALUES (10, 'Bye');
-- Snowflake only allows the usage of FETCH in subqueries that are uncorrelated scalar, this subquery execution will fail
SELECT col2
FROM
tableA
WHERE col2 =
--** SSC-FDM-0002 - CORRELATED SUBQUERIES MAY HAVE SOME FUNCTIONAL DIFFERENCES. **
!!!RESOLVE EWI!!! /*** SSC-EWI-0108 - THE FOLLOWING SUBQUERY MATCHES AT LEAST ONE OF THE PATTERNS CONSIDERED INVALID AND MAY PRODUCE COMPILATION ERRORS ***/!!! (SELECT
ANY_VALUE( col4) FROM
tableB
WHERE col3 = col1
FETCH FIRST 1 ROW ONLY);
-- This subquery is uncorrelated scalar so FETCH is valid to use
SELECT col2
FROM
tableA
WHERE col2 = (SELECT col4 FROM
tableB
FETCH FIRST 1 ROW ONLY);
Recommendations¶
Check the subquery in Snowflake, if it compiles without problems then this EWI can be safely ignored.
Please check the complex patterns section for subqueries inside the assessment report, it contains a list of the patterns that normally invalidate subqueries and their occurrences, it can be used to review the migrated subqueries and why are they considered invalid.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0068¶
This EWI is deprecated, please refer to SSC-FDM-0029 documentation
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¶
SQL Server:¶
CREATE OR ALTER FUNCTION PURCHASING.FOO()
RETURNS INT
AS
BEGIN
DECLARE @i int = 0, @p int;
Select @p = COUNT(*) FROM PURCHASING.VENDOR
WHILE (@p < 1000)
BEGIN
SET @i = @i + 1
SET @p = @p + @i
END
IF (@i = 6)
RETURN 1
RETURN @p
END;
!!!RESOLVE EWI!!! /*** SSC-EWI-0068 - USER DEFINED FUNCTION WAS TRANSFORMED TO SNOWFLAKE PROCEDURE ***/!!!
CREATE OR REPLACE PROCEDURE PURCHASING.FOO ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"transact"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
I INT := 0;
P INT;
BEGIN
Select
COUNT(*)
INTO
:P
FROM
PURCHASING.VENDOR;
WHILE (:P < 1000) LOOP
I := :I + 1;
P := :P + :I;
END LOOP;
IF ((:I = 6)) THEN
RETURN 1;
END IF;
RETURN :P;
END;
$$;
Oracle:¶
CREATE OR REPLACE FUNCTION FUN1(PAR1 VARCHAR)
RETURN VARCHAR
IS
VAR1 VARCHAR(20);
VAR2 VARCHAR(20);
BEGIN
SELECT COL1 INTO VAR1 FROM TABLE1 where col1 = 1;
VAR2 := PAR1 || VAR1;
RETURN VAR2;
END;
!!!RESOLVE EWI!!! /*** SSC-EWI-0068 - USER DEFINED FUNCTION WAS TRANSFORMED TO SNOWFLAKE PROCEDURE ***/!!!
CREATE OR REPLACE PROCEDURE FUN1(PAR1 VARCHAR)
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
VAR1 VARCHAR(20);
VAR2 VARCHAR(20);
BEGIN
SELECT COL1 INTO
:VAR1
FROM
TABLE1
where col1 = 1;
VAR2 := NVL(:PAR1 :: STRING, '') || NVL(:VAR1 :: STRING, '');
RETURN :VAR2;
END;
$$;
Recommendations¶
Separate the inside queries to maintain the same logic.
The source code may need to be restructured to fit with the Snowflake user-defined functions approach.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0028¶
Severity¶
Medium
Description¶
This message appears when a type is not supported in Snowflake.
Example¶
Input Code (Oracle):¶
CREATE TABLE MYTABLE
(
COL1 SYS.ANYDATASET
);
Output Code:¶
CREATE OR REPLACE TABLE MYTABLE
(
!!!RESOLVE EWI!!! /*** SSC-EWI-0028 - TYPE NOT SUPPORTED BY SNOWFLAKE ***/!!!
COL1 SYS.ANYDATASET
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
;
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0008¶
Severity¶
Medium
Description¶
This warning is added when the collate clause is used as a column option because it is supported in Snowflake but may behave differently in the collate specification. Please review the collate documentation in order to verify which specifiers are supported in Snowflake.
Example Code¶
Input Code:¶
CREATE TABLE TABLE01 (
col1 text COLLATE "C"
);
Output Code:¶
CREATE TABLE TABLE01 (
col1 text
!!!RESOLVE EWI!!! /*** SSC-EWI-0008 - COLLATE CLAUSE MAY HAVE A DIFFERENT BEHAVIOR IN SNOWFLAKE. ***/!!! COLLATE "C"
);
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0049¶
This EWI
is deprecated, please refer to SSC-FDM-0023 documentation.
Severity¶
Medium
Description¶
Snowconvert transforms Global Temporary tables into regular Create Table. References to these tables may behave different than expected.
Code example¶
Input¶
create global temporary table t1
(col1 varchar);
create view view1 as
select col1 from t1;
Output¶
--** SSC-FDM-0009 - GLOBAL TEMPORARY TABLE FUNCTIONALITY NOT SUPPORTED. **
CREATE OR REPLACE TABLE t1
(col1 varchar)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
;
CREATE OR REPLACE VIEW view1
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
AS
select col1 from
!!!RESOLVE EWI!!! /*** SSC-EWI-0049 - A Global Temporary Table is being referenced ***/!!!
t1;
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0109¶
Severity¶
Medium
Description¶
The Alter Table syntax used is not applicable in Snowflake, then this message is being added.
Example Code:¶
Input Code:¶
ALTER TABLE SOMENAME DEFAULT COLLATION SOMENAME;
ALTER TABLE SOMENAME ROW ARCHIVAL;
ALTER TABLE SOMENAME MODIFY CLUSTERING;
ALTER TABLE SOMENAME DROP CLUSTERING;
ALTER TABLE SOMENAME SHRINK SPACE COMPACT CASCADE;
Output Code:¶
!!!RESOLVE EWI!!! /*** SSC-EWI-0109 - ALTER TABLE SYNTAX NOT APPLICABLE IN SNOWFLAKE ***/!!!
ALTER TABLE SOMENAME
DEFAULT COLLATION SOMENAME;
!!!RESOLVE EWI!!! /*** SSC-EWI-0109 - ALTER TABLE SYNTAX NOT APPLICABLE IN SNOWFLAKE ***/!!!
ALTER TABLE SOMENAME
ROW ARCHIVAL;
!!!RESOLVE EWI!!! /*** SSC-EWI-0109 - ALTER TABLE SYNTAX NOT APPLICABLE IN SNOWFLAKE ***/!!!
ALTER TABLE SOMENAME
MODIFY CLUSTERING;
!!!RESOLVE EWI!!! /*** SSC-EWI-0109 - ALTER TABLE SYNTAX NOT APPLICABLE IN SNOWFLAKE ***/!!!
ALTER TABLE SOMENAME
DROP CLUSTERING;
!!!RESOLVE EWI!!! /*** SSC-EWI-0109 - ALTER TABLE SYNTAX NOT APPLICABLE IN SNOWFLAKE ***/!!!
ALTER TABLE SOMENAME
SHRINK SPACE COMPACT CASCADE;
Recommendations¶
No additional user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0009¶
Severity¶
Low
Description¶
Currently, there is no support in Snowflake for extended regular expression beyond the POSIX Basic Regular Expression syntax (link removed).
This EWI is added every time a function call to REGEX_SUBSTR, REGEX_REPLACE, or REGEX_INSTR is transformed to SnowFlake to warn the user about possible unsupported regular expressions. Some of the features not supported are lookahead, lookbehind, and non-capturing groups.
Example Code¶
Teradata:¶
SELECT REGEXP_SUBSTR('qaqequ','q(?=u)', 1, 1);
Snowflake Scripting:¶
SELECT
!!!RESOLVE EWI!!! /*** SSC-EWI-TD0020 - REGEXP_SUBSTR FUNCTION ONLY SUPPORTS POSIX REGULAR EXPRESSIONS ***/!!!
REGEXP_SUBSTR('qaqequ','q(?=u)', 1, 1);
Recommendations¶
Check the regular expression used in each case to determine whether it needs manual intervention. More information about expanded regex support and alternatives in SnowFlake can be found here (https://community.snowflake.com/s/question/0D50Z00007ENLKsSAP/expanded-support-for-regular-expressions-regex).
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0031¶
Some parts in the output code are omitted for clarity reasons.
Severity ¶
Medium
Description ¶
This warning is used to report that a specific built-in function of Teradata, Oracle, or SQL Server is not supported.
Example Code ¶
Input Code (Oracle):¶
SELECT VALUE(ST) FROM SampleTable ST;
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT
!!!RESOLVE EWI!!! /*** SSC-EWI-0031 - VALUE FUNCTION NOT SUPPORTED ***/!!!
VALUE(ST) FROM
SampleTable ST;
Recommendations ¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0005¶
Severity¶
Critical
Description¶
This issue appears when trying to convert the source code occurs an unexpected transformation error and the output code file can not be generated.
Recommendations¶
Check the error log file for more information about the issue.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0054¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Low
Description¶
This error happens when a correlated subquery is found within an OR logical expression of an OUTER JOIN (Left, Right or Full). In those cases they could produce inconsistent results or cause the following error:
SQL compilation error: Unsupported subquery type cannot be evaluated.
These limitations with subqueries are briefly mentioned in Snowflake documentation and some information about them can also be found in Snowflake forums. (https://community.snowflake.com/s/question/0D53r00009mIxwYCAS/sql-compilation-error-unsupported-subquery-type-cannot-be-evaluated)
Example code¶
Input Code (Teradata):¶
SELECT a.Column1, b.Column2
FROM
TableA a
LEFT JOIN TableB b ON (a.Column1 = b.Column1)
AND (
a.Column2 = b.Column2
OR EXISTS(
SELECT * FROM Table3 c
WHERE c.Column1 = a.Column1
)
);
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT
a.Column1,
b.Column2
FROM
TableA a
LEFT JOIN
TableB b ON (a.Column1 = b.Column1)
AND (
a.Column2 = b.Column2
OR EXISTS
!!!RESOLVE EWI!!! /*** SSC-EWI-0054 - CORRELATED SUBQUERIES WITHIN AN OR EXPRESSION OF AN OUTER JOIN COULD CAUSE COMPILATION ERRORS ***/!!!(
SELECT
* FROM
Table3 c
WHERE c.Column1 = a.Column1
)
);
Recommendations¶
Verify the output code does not produce a compilation error.
Verify the output code’s functional equivalence.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0015¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Medium
Description¶
This section describes the different issues that could be triggered by PIVOT and UNPIVOT clauses. The not-supported scenarios are presented in the following table.
PIVOT |
UNPIVOT |
ORACLE |
TERADATA |
|
---|---|---|---|---|
MULTIPLE COLUMN |
X |
X |
X |
X |
RENAME COLUMN |
X |
X |
X |
X |
MULTIPLE FUNCTION |
X |
X |
X |
|
WITH CLAUSE |
X |
X |
||
XML OUTPUT FORMAT |
X |
X |
||
IN CLAUSE SUBQUERY |
X |
X |
X |
|
IN CLAUSE ANY SEQUENCE |
X |
X |
||
INCLUDE/EXCLUDE NULLS |
X |
X |
X |
MULTIPLE COLUMN¶
Multiple columns are not supported by PIVOT and UNPIVOT clauses.
Example Code¶
Input Code:¶
SELECT * FROM star1p UNPIVOT ((sales,cogs) FOR yr_qtr
IN ((Q101Sales, Q101Cogs) AS 'Q101A',
(Q201Sales, Q201Cogs) AS 'Q201A',
(Q301Sales, Q301Cogs) AS 'Q301A')) AS Tmp;
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT * FROM
star1p
!!!RESOLVE EWI!!! /*** SSC-EWI-0015 - PIVOT/UNPIVOT MULTIPLE COLUMN NOT SUPPORTED ***/!!!
UNPIVOT ((sales,cogs) FOR yr_qtr
!!!RESOLVE EWI!!! /*** SSC-EWI-0015 - PIVOT/UNPIVOT MULTIPLE COLUMN NOT SUPPORTED ***/!!!
IN ((Q101Sales, Q101Cogs) AS 'Q101A',
(Q201Sales, Q201Cogs) AS 'Q201A',
(Q301Sales, Q301Cogs) AS 'Q301A')) AS Tmp;
RENAME COLUMN¶
Renaming columns with aliases is not supported in snowflake UNPIVOT clauses, Snow Convert is going to remove aliases for functions or columns in order to create a valid query and check that this change does not affect the original functionality.
For PIVOT, the use of column aliases is only supported in SnowConvert for Teradata if the following two conditions are true: all expressions inside the IN clause have an alias associated and Snowconvert has information about the columns that will be generated as a result, either by providing the table definition or using a subquery with an explicit column list as input to the clause.
Example Code¶
Input Code:¶
CREATE TABLE star1(
country VARCHAR(20),
state VARCHAR(10),
yr INTEGER,
qtr VARCHAR(3),
sales INTEGER,
cogs INTEGER
);
--SAMPLE 1
SELECT * FROM db1.star1p UNPIVOT (column1 FOR for_column
IN (col1 AS 'as_col1', col2 AS 'as_col2')) Tmp;
--SAMPLE 2
SELECT *
FROM star1 PIVOT (
SUM(sales) as ss1 FOR qtr
IN ('Q1' AS Quarter1,
'Q2' AS Quarter2,
'Q3' AS Quarter3)
)Tmp;
--SAMPLE 3
SELECT
*
FROM (
SELECT
country,
state,
yr,
qtr,
sales,
cogs
FROM star1 ) A
PIVOT (
SUM(sales) as ss1 FOR qtr
IN ('Q1' AS Quarter1,
'Q2' AS Quarter2,
'Q3' AS Quarter3)
)Tmp;
Output Code:¶
CREATE OR REPLACE TABLE star1 (
country VARCHAR(20),
state VARCHAR(10),
yr INTEGER,
qtr VARCHAR(3),
sales INTEGER,
cogs INTEGER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "teradata", "convertedOn": "08/14/2024" }}'
;
--SAMPLE 1
--** SSC-FDM-0007 - MISSING DEPENDENT OBJECT "db1.star1p" **
SELECT
* FROM db1.star1p UNPIVOT (column1 FOR for_column
IN (col1 AS 'as_col1', col2 AS 'as_col2')) Tmp !!!RESOLVE EWI!!! /*** SSC-EWI-0073 - PENDING FUNCTIONAL EQUIVALENCE REVIEW FOR 'PivotUnpivotTableReference' NODE ***/!!!;
--SAMPLE 2
SELECT
*
FROM
star1 PIVOT (
SUM(sales) FOR qtr IN ('Q1',
'Q2',
'Q3')) Tmp (
country,
state,
yr,
cogs,
Quarter1_ss1,
Quarter2_ss1,
Quarter3_ss1
);
--SAMPLE 3
SELECT
*
FROM (
SELECT
country,
state,
yr,
qtr,
sales,
cogs
FROM
star1
) A
PIVOT (
SUM(sales) FOR qtr IN ('Q1',
'Q2',
'Q3')) Tmp (
country,
state,
yr,
cogs,
Quarter1_ss1,
Quarter2_ss1,
Quarter3_ss1
);
MULTIPLE FUNCTION¶
Multiple function is not supported for PIVOT clauses, sometimes multiple function queries could be re-written using case statements, see the following Teradata sample for more information https://docs.teradata.com/r/756LNiPSFdY~4JcCCcR5Cw/L0kKSOrOeu_68mcW3o8ilw (https://docs.teradata.com/r/756LNiPSFdY~4JcCCcR5Cw/L0kKSOrOeu_68mcW3o8ilw)
Example Code¶
Input Code:¶
SELECT *
FROM STAR1 PIVOT(SUM(COL1), SUM(COL2) FOR YR IN ('Y1', 'Y2', 'Y3'))TMP;
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT
*
FROM
STAR1
!!!RESOLVE EWI!!! /*** SSC-EWI-0015 - PIVOT/UNPIVOT MULTIPLE FUNCTION NOT SUPPORTED ***/!!!
PIVOT(SUM(COL1), SUM(COL2) FOR YR IN ('Y1', 'Y2', 'Y3'))TMP;
WITH CLAUSE¶
Teradata PIVOT has an optional WITH clause, this is not allowed in Snowflake’s PIVOT.
Example Code¶
Input Code:¶
SELECT *
FROM STAR1 PIVOT(SUM(COL1) FOR YR IN ('Y1', 'Y2', 'Y3') WITH SUM(*) AS withalias)TMP;
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT
*
FROM
STAR1 PIVOT(SUM(COL1) FOR YR IN ('Y1', 'Y2', 'Y3')
!!!RESOLVE EWI!!! /*** SSC-EWI-0015 - PIVOT/UNPIVOT WITH CLAUSE NOT SUPPORTED ***/!!!
WITH SUM(*) AS withalias)TMP;
XML OUTPUT FORMAT¶
XML output for the PIVOT clause is not supported by Snowflake.
Example Code¶
Input Code:¶
SELECT * FROM (SELECT product_code, quantity FROM pivot_test)
PIVOT XML (SUM(quantity)
FOR (product_code) IN ('A','B','C'));
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT * FROM
(
SELECT product_code, quantity FROM
pivot_test)
!!!RESOLVE EWI!!! /*** SSC-EWI-0015 - PIVOT/UNPIVOT XML OUTPUT FORMAT NOT SUPPORTED ***/!!!
PIVOT (SUM(quantity) FOR product_code IN ( 'A', 'B', 'C'));
IN CLAUSE SUBQUERY¶
Subqueries for the IN clause are not supported.
Example Code¶
Input Code:¶
SELECT * FROM s1 PIVOT(SUM(COL1) FOR FORCOL IN (SELECT SELCOL FROM S2))DT;
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT * FROM
s1 PIVOT (SUM(COL1) FOR FORCOL
!!!RESOLVE EWI!!! /*** SSC-EWI-0015 - PIVOT/UNPIVOT IN CLAUSE SUBQUERY NOT SUPPORTED ***/!!! IN (SELECT SELCOL FROM
S2));
IN CLAUSE ANY SEQUENCE¶
This error is triggered when ANY keyword is used in the IN clause. This is currently not supported.
Example Code¶
Input Code:¶
SELECT * FROM (SELECT product_code, quantity FROM pivot_test)
PIVOT (SUM(quantity)
FOR product_code IN (ANY, ANY, ANY));
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT * FROM (SELECT product_code, quantity FROM
pivot_test)
PIVOT (SUM(quantity)
FOR product_code
!!!RESOLVE EWI!!! /*** SSC-EWI-0015 - PIVOT/UNPIVOT IN CLAUSE ANY SEQUENCE NOT SUPPORTED ***/!!!
IN (ANY, ANY, ANY));
INCLUDE/EXCLUDE NULLS¶
INCLUDE NULLS or EXCLUDE NULLS are not valid options for UNPIVOT clauses in Snowflake.
Example Code¶
Input Code:¶
SELECT * FROM db1.star1p UNPIVOT INCLUDE NULLS (column1 FOR for_column IN (col1, col2)) Tmp;
Output Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT * FROM
db1.star1p
!!!RESOLVE EWI!!! /*** SSC-EWI-0015 - PIVOT/UNPIVOT INCLUDE NULLS NOT SUPPORTED ***/!!!
UNPIVOT ( column1 FOR for_column IN (
col1,
col2)) Tmp;
Recommendations¶
Re-write the query if possible, otherwise, no additional user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0021¶
Severity¶
Medium
Description¶
This message appears when a specific node or statement from the source code is not supported in Snowflake.
Example Code¶
Input Code:¶
WITH my_av ANALYTIC VIEW AS
(USING sales_av HIERARCHIES(time_hier) ADD MEASURES(lag_sales AS (LAG(sales) OVER (HIERARCHY time_hier OFFSET 1 ))))
SELECT aValue from my_av;
Output Code:¶
!!!RESOLVE EWI!!! /*** SSC-EWI-0021 - SubavFactoring NOT SUPPORTED IN SNOWFLAKE ***/!!!
WITH my_av ANALYTIC VIEW AS
(USING sales_av HIERARCHIES(time_hier) ADD MEASURES(lag_sales AS (LAG(sales) OVER (HIERARCHY time_hier OFFSET 1 ))))
SELECT aValue from my_av;
Recommendations¶
If this error happens is because there is no Snowflake equivalent for the node that is being converted.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0110¶
Severity¶
Low
Description¶
When there are missing dependencies, the EWI is added to indicate that a transformation cannot be executed. SnowConvert utilizes abstract syntax trees to create a semantic model of the input code, which is then used to generate new code that replicates the functionality of the original source. However, in this particular scenario, the transformation could not be completed because the semantic model lacks certain dependencies.
Example code¶
Input Code :¶
ALTER TABLE MissingTable ADD
CONSTRAINT constraint1 DEFAULT (suser_name()) FOR col1;
Output Code:¶
--** SSC-FDM-0007 - MISSING DEPENDENT OBJECT "MissingTable" **
!!!RESOLVE EWI!!! /*** SSC-EWI-0110 - TRANSFORMATION NOT PERFORMED DUE TO MISSING DEPENDENCIES ***/!!!
ALTER TABLE MissingTable
ADD
CONSTRAINT constraint1 DEFAULT (CURRENT_USER()) FOR col1;
Recommendations¶
Add the missing dependencies to the input code.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0001¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Critical
Description¶
This issue occurs when there is an error while parsing the source code that is being converted. It means there is a source code syntax error or a specific statement of the code is not being recognized yet.
Example Code¶
The following example illustrates different parsing error scenarios where invalid syntax is placed in the input. Notice how the message varies between every scenario, these contents may be helpful on isolating and fixing the issue. For more information check “Message Contents” below.
Input Code:¶
CRATE;
CREATE TABLE someTable(col1 INTEGER, !);
CREATE TABRE badTable(col1 INTEGER);
CREATE PROCEDURE proc1()
BEGIN
CREATE TABLE badEmbeddedTable(col1 INTEGER);
END;
Output Code:¶
-- ** SSC-EWI-0001 - UNRECOGNIZED TOKEN ON LINE '1' COLUMN '1' OF THE SOURCE CODE STARTING AT 'CRATE'. EXPECTED 'STATEMENT' GRAMMAR. LAST MATCHING TOKEN WAS 'CRATE' ON LINE '1' COLUMN '1'. **
--CRATE
;
CREATE OR REPLACE TABLE someTable (
col1 INTEGER
-- ,
-- ** SSC-EWI-0001 - UNRECOGNIZED TOKEN ON LINE '3' COLUMN '37' OF THE SOURCE CODE STARTING AT '!'. EXPECTED 'Column Definition' GRAMMAR. LAST MATCHING TOKEN WAS ',' ON LINE '3' COLUMN '35'. FAILED TOKEN WAS '!' ON LINE '3' COLUMN '37'. **
-- !
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "teradata", "convertedOn": "07/04/2024" }}'
;
-- ** SSC-EWI-0001 - UNRECOGNIZED TOKEN ON LINE '5' COLUMN '1' OF THE SOURCE CODE STARTING AT 'CREATE'. EXPECTED 'STATEMENT' GRAMMAR. LAST MATCHING TOKEN WAS 'CREATE' ON LINE '5' COLUMN '1'. **
--CREATE TABRE badTable(col1 INTEGER)
;
CREATE OR REPLACE PROCEDURE proc1 ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "teradata", "convertedOn": "07/04/2024" }}'
EXECUTE AS CALLER
AS
$$
BEGIN
CREATE OR REPLACE TABLE badEmbeddedTable (
col1 INTEGER);
END;
$$;
Message Contents¶
Starting clause: Specifies the starting location (line, column, and ‘text’) of the unrecognized code. The code will be commented from the ‘text’ element onward for every unrecognized element until the parser locates a possible recovery point.
Expected grammar clause: Specifies the type of grammar that the parser was expecting. Check if the commented code has a matching type of the expected grammar.
Last matching token clause (OPTIONAL): May appear if the unrecognized code was partially recognized. This signals the point up until the parser recognized valid elements, so check the following tokens in the commented code to make sure they are valid.
Failed Token clause (OPTIONAL): May only be present when a “Last matching Token clause” is also present. This represents at which point the parser ultimately determined the code is invalid or not recognized. Make sure this element can be placed in this syntactical location.
Deprecated Message Contents¶
The items in this list are not actively in usage, and are left here for historical purposes.
Recovery Code (DEPRECATED): It is intended to be used as an error code, and may be supplied for better support during parser upgrade requests. It represents how the parser triggered its recovery mechanism.
Recommendations¶
Check if the source code has the correct syntax.
The message can be used to isolate and solve the issue.
If the syntax is not supported, it may be manually changed to a supported syntax.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0035¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Low
Description¶
CHECK constraint is not supported by Snowflake but it does not affect functionally.
Example Code¶
Input Code Oracle :¶
CREATE TABLE "Schema"."BaseTable"(
"COLUMN1" VARCHAR2(255),
CHECK ( COLUMN1 IS NOT NULL )
);
Output Code:¶
CREATE OR REPLACE TABLE "Schema"."BaseTable" (
"COLUMN1" VARCHAR(255),
!!!RESOLVE EWI!!! /*** SSC-EWI-0035 - CHECK STATEMENT NOT SUPPORTED ***/!!!
CHECK ( COLUMN1 IS NOT NULL )
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
;
Input Code Teradata:¶
CREATE TABLE TABLE1,
NO FALLBACK,
NO BEFORE JOURNAL,
NO AFTER JOURNAL
(
COL0 BYTEINT,
CONSTRAINT constraint_name CHECK (COL1 < COL2)
)
Output Code:¶
CREATE OR REPLACE TABLE TABLE1
(
COL0 BYTEINT,
!!!RESOLVE EWI!!! /*** SSC-EWI-0035 - CHECK STATEMENT NOT SUPPORTED ***/!!!
CONSTRAINT constraint_name CHECK (COL1 < COL2)
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"teradata"}}'
;
Input Code SqlServer¶
ALTER TABLE table_name2
ADD column_name VARCHAR(255)
CONSTRAINT constraint_name
CHECK NOT FOR REPLICATION (column_name > 1);
Output Code:¶
ALTER TABLE IF EXISTS table_name2
ADD column_name VARCHAR(255)
!!!RESOLVE EWI!!! /*** SSC-EWI-0035 - CHECK STATEMENT NOT SUPPORTED ***/!!!
CONSTRAINT constraint_name
CHECK NOT FOR REPLICATION (column_name > 1);
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0064¶
Severity¶
High
Description¶
This error happens when a Custom Type is referenced in a source for a DML statement, but the Custom Type was never defined.
For example in a Table Column whose type might be a UDT but it was never defined.
Not to be confused with SSC-FDM-0015, which is when it was referenced in a DDL query.
Example Code¶
Input Code (Oracle):¶
--Type was never defined
--CREATE TYPE type1;
CREATE TABLE table1
(
--the type will be unresolved
column1 type1
);
SELECT
column1
FROM table1;
Output Code:¶
--Type was never defined
--CREATE TYPE type1;
!!!RESOLVE EWI!!! /*** SSC-EWI-0050 - MISSING DEPENDENT OBJECT "type1" ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0063 - 'PUBLIC.table1_view' ADDED BECAUSE 'table1' USED A CUSTOM TYPE ***/!!!
CREATE OR REPLACE TABLE table1
(
--the type will be unresolved
column1 VARIANT !!!RESOLVE EWI!!! /*** SSC-EWI-0064 - REFERENCED CUSTOM TYPE 'type1' IN QUERY NOT FOUND, USAGES MAY BE AFFECTED ***/!!! /*** SSC-FDM-0015 - DATA TYPE 'type1' NOT RECOGNIZED ***/
);
CREATE OR REPLACE VIEW PUBLIC.table1_view
AS
SELECT
column1
FROM
table1;
SELECT
column1 !!!RESOLVE EWI!!! /*** SSC-EWI-0064 - REFERENCED CUSTOM TYPE 'type1' IN QUERY NOT FOUND, USAGES MAY BE AFFECTED ***/!!!
FROM
table1;
Recommendations¶
Verify that the type that was referenced was defined in the input code.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0025¶
The EWI is only generated when Javascript is the target language for Stored Procedures. This is a deprecated translation feature, as Snowflake Scripting is the recommended target language for Stored Procedures.
Some parts in the output code are omitted for clarity reasons.
Severity¶
Low
Description¶
The action of binding time variables might require changes in the query that contains them.
Example Code¶
Input Code:¶
-- Additional Params: -t javascript
CREATE PROCEDURE P_1025()
BEGIN
DECLARE LN_EMP_KEY_NO_PARAM NUMERIC DEFAULT -1;
DECLARE FLOATVARNAME FLOAT DEFAULT 12.1;
DECLARE hErrorMsg CHARACTER(30) DEFAULT 'NO ERROR';
DECLARE CurrTs TIME DEFAULT CURRENT_TIME;
DECLARE CurrTs2 TIME DEFAULT CURRENT_TIMESTAMP;
END;
Output Code:¶
CREATE OR REPLACE PROCEDURE P_1025 ()
RETURNS STRING
LANGUAGE JAVASCRIPT
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"teradata"}}'
EXECUTE AS CALLER
AS
$$
// SnowConvert Helpers Code section is omitted.
var LN_EMP_KEY_NO_PARAM = -1;
var FLOATVARNAME = 12.1;
var HERRORMSG = `NO ERROR`;
var CURRTS = new Date() /*** SSC-EWI-0025 - BINDING TIME VARIABLE MIGHT REQUIRE CHANGE IN QUERY. ***/;
var CURRTS2 = new Date();
$$;
Recommendations¶
No additional user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0011¶
Severity¶
High
Description¶
This error appears when there is an unexpected end of the statement in the source code and the error cannot be handled correctly.
Recommendations¶
Check if the source code is incomplete or if the statement that is being converted ends correctly.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0040¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Low
Description¶
This warning is added when there is a statement that is not supported in SnowFlake.
Example Code¶
In the following example, the PERCENT
clause from SQL Server is used on the SELECT query, this is not supported by Snowflake.
Input Code (SQL Server):¶
SELECT TOP 1 PERCENT * FROM SampleTable;
Source Code:¶
// SnowConvert Helpers Code section is omitted.
SELECT
TOP 1 !!!RESOLVE EWI!!! /*** SSC-EWI-0040 - THE STATEMENT IS NOT SUPPORTED IN SNOWFLAKE ***/!!!
*
FROM
SampleTable;
Recommendations¶
Review the original functionality of the statement and check if it is actually needed for your specific needs in Snowflake.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0034¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Low
Description¶
This warning appears when the format of the column used in a CAST function is removed.
Example Code¶
Input Code (Teradata):¶
CREATE VIEW SampleView AS
SELECT
DAY_DATE(FORMAT 'MMM-YYYY') + 1
FROM
SampleTable;
Output Code:¶
// SnowConvert Helpers Code section is omitted.
CREATE OR REPLACE VIEW SampleView
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"teradata"}}'
AS
SELECT
DAY_DATE !!!RESOLVE EWI!!! /*** SSC-EWI-0034 - FORMAT 'MMM-YYYY' REMOVED. ***/!!! + 1
FROM
SampleTable;
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0086¶
This EWI
is deprecated, please refer to SSC-FDM-0030 documentation.
Severity¶
Low
Description¶
The given identifier has invalid characters for the output language. Those characters were replaced with their UTF-8 codes.
Example Code¶
Input Code (Oracle):¶
CREATE PROCEDURE PROC1
AS
"VAR0" INT;
"VAR`/1ͷ" VARCHAR(20);
"o*/o" FLOAT;
" . " INT;
". ." INT;
"123Name" INT;
"return" INT;
yield INT;
ident#10 INT;
BEGIN
NULL;
END;
Output Code:¶
CREATE OR REPLACE PROCEDURE PROC1 ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
"VAR0" INT;
!!!RESOLVE EWI!!! /*** SSC-EWI-0086 - IDENTIFIER '"VAR`/1ͷ"' HAS INVALID CHARACTERS. CHARACTERS WERE REPLACED WITH THEIR UTF-8 CODES ***/!!!
VAR_u60_u2F1ͷ VARCHAR(20);
!!!RESOLVE EWI!!! /*** SSC-EWI-0086 - IDENTIFIER '"o*/o"' HAS INVALID CHARACTERS. CHARACTERS WERE REPLACED WITH THEIR UTF-8 CODES ***/!!!
o_u2A_u2Fo FLOAT;
!!!RESOLVE EWI!!! /*** SSC-EWI-0086 - IDENTIFIER '" . "' HAS INVALID CHARACTERS. CHARACTERS WERE REPLACED WITH THEIR UTF-8 CODES ***/!!!
_u20_u2E_u20 INT;
!!!RESOLVE EWI!!! /*** SSC-EWI-0086 - IDENTIFIER '". ."' HAS INVALID CHARACTERS. CHARACTERS WERE REPLACED WITH THEIR UTF-8 CODES ***/!!!
_u2E_u20_u2E INT;
"123Name" INT;
"return" INT;
yield INT;
IDENT_HASHTAG_10 INT;
BEGIN
NULL;
END;
$$;
Recommendations¶
No end-user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0010¶
Severity¶
Critical
Description¶
This error appears when there is not a transformation rule for a specific procedure statement.
Recommendations¶
Check if the procedure statement is correct.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0041¶
This EWI
is deprecated, please refer to SSC-OOS-0001 documentation.
Description¶
This issue happens when a source code file has an encoding format not recognized by the tool. Character encoding is the process of assigning numbers to graphical characters, in this context written characters of human language, thus the error indicates the conversion tool could not recognize certain characters.
Recommendations¶
All files in the input folder should have the same encoding to avoid this error.
The appropriate encoding should be selected through the conversion settings or by utilizing the –encoding conversion parameter with the CLI. To determine which encoding to select online tools such as Free Online Formater (https://freeonlineformatter.com/encoding-string) can be used or run the command
file -i *
in the case of Linux or OS.If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0101¶
Severity¶
Low
Description¶
Snowflake does not operate transaction label names because there should not be nested transactions to identify in different COMMIT or ROLLBACK statements.
Example code¶
Input Code (SQL Server):¶
CREATE PROCEDURE TestTransaction
AS
BEGIN
DROP TABLE IF EXISTS NEWTABLE;
CREATE TABLE NEWTABLE(COL1 INT, COL2 VARCHAR);
BEGIN TRANSACTION LabelA;
INSERT INTO NEWTABLE VALUES (1, 'MICHAEL');
INSERT INTO NEWTABLE VALUES(2, 'JACKSON');
COMMIT TRANSACTION LabelA;
END
Output Code:¶
CREATE OR REPLACE PROCEDURE TestTransaction ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"transact"}}'
EXECUTE AS CALLER
AS
$$
BEGIN
DROP TABLE IF EXISTS NEWTABLE;
CREATE OR REPLACE TABLE NEWTABLE (
COL1 INT,
COL2 VARCHAR
);
BEGIN TRANSACTION
!!!RESOLVE EWI!!! /*** SSC-EWI-0101 - COMMENTED OUT TRANSACTION LABEL NAME BECAUSE IS NOT APPLICABLE IN SNOWFLAKE ***/!!!
LabelA;
INSERT INTO NEWTABLE VALUES (1, 'MICHAEL');
INSERT INTO NEWTABLE VALUES(2, 'JACKSON');
COMMIT;
END;
$$;
Recommendations¶
No end-user action is required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0030¶
Some parts in the output code are omitted for clarity reasons.
Severity¶
Medium
Description¶
This error is used to indicate that the statement has usages of dynamic SQL. Each specific source language has its own set of statements that can execute dynamic SQL. Dynamic SQL refers to code that is built as text using the string manipulation tools the database engine language provides.
This scenario is considered a complex pattern because dynamic SQL is built and executed in runtime making it more difficult to track and debug errors. This error is meant to be a helper to spot some problems that a static-code analyzer such as Snow Convert cannot.
Code Example¶
Teradata¶
REPLACE PROCEDURE teradata_dynamic_sql()
BEGIN
DECLARE str_sql VARCHAR(20);
SET str_sql = 'UPDATE TABLE
SET COLA = 0,
COLB = ''test''';
EXECUTE IMMEDIATE str_sql;
EXECUTE IMMEDIATE 'INSERT INTO TABLE1(COL1) VALUES(1)';
EXECUTE str_sql;
CALL DBC.SysExecSQL('INSERT INTO TABLE1(COL1) VALUES(1)');
END;
CREATE OR REPLACE PROCEDURE teradata_dynamic_sql ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "teradata", "convertedOn": "07/04/2024" }}'
EXECUTE AS CALLER
AS
$$
DECLARE
str_sql VARCHAR(20);
BEGIN
str_sql := 'UPDATE "TABLE"
SET COLA = 0,
COLB = ''test''';
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE str_sql;
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE 'INSERT INTO TABLE1 (COL1)
VALUES (1);';
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE str_sql;
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE 'INSERT INTO TABLE1 (COL1)
VALUES (1);';
END;
$$;
Oracle¶
CREATE OR REPLACE PROCEDURE oracle_dynamic_sql
AS
dynamic_statement VARCHAR(100);
numeric_variable INTEGER;
dynamic_statement VARCHAR(100);
column_variable VARCHAR(100);
cursor_variable SYS_REFCURSOR;
c INTEGER;
dynamic_statement VARCHAR(100);
BEGIN
dynamic_statement := 'INSERT INTO sample_table(col1) VALUES(1)';
numeric_variable := 3;
column_variable := 'col1';
EXECUTE IMMEDIATE dynamic_statement;
EXECUTE IMMEDIATE 'INSERT INTO sample_table(col1) VALUES(' || numeric_variable || ')';
OPEN cursor_variable FOR dynamic_statement;
OPEN cursor_variable FOR 'SELECT ' || column_variable || ' FROM sample_table';
OPEN cursor_variable FOR 'SELECT col1 FROM sample_table';
c := DBMS_SQL.OPEN_CURSOR;
dynamic_statement := 'SELECT * FROM sample_table';
DBMS_SQL.PARSE(c, dynamic_statement);
END;
CREATE OR REPLACE PROCEDURE oracle_dynamic_sql ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
dynamic_statement VARCHAR(100);
numeric_variable INTEGER;
dynamic_statement VARCHAR(100);
column_variable VARCHAR(100);
cursor_variable_res RESULTSET;
c INTEGER;
dynamic_statement VARCHAR(100);
BEGIN
dynamic_statement := 'INSERT INTO sample_table(col1) VALUES(1)';
numeric_variable := 3;
column_variable := 'col1';
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE :dynamic_statement;
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE 'INSERT INTO sample_table(col1) VALUES(' || NVL(:numeric_variable :: STRING, '') || ')';
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
cursor_variable_res := (
EXECUTE IMMEDIATE :dynamic_statement
);
LET cursor_variable CURSOR
FOR
cursor_variable_res;
OPEN cursor_variable;
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
cursor_variable_res := (
EXECUTE IMMEDIATE 'SELECT ' || NVL(:column_variable :: STRING, '') || ' FROM
sample_table'
);
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0133 - THE CURSOR VARIABLE NAMED 'cursor_variable' HAS ALREADY BEEN ASSIGNED IN ANOTHER CURSOR ***/!!!
LET cursor_variable CURSOR
FOR
cursor_variable_res;
OPEN cursor_variable;
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
cursor_variable_res := (
EXECUTE IMMEDIATE 'SELECT col1 FROM
sample_table'
);
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0133 - THE CURSOR VARIABLE NAMED 'cursor_variable' HAS ALREADY BEEN ASSIGNED IN ANOTHER CURSOR ***/!!!
LET cursor_variable CURSOR
FOR
cursor_variable_res;
OPEN cursor_variable;
c :=
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0076 - TRANSLATION FOR BUILT-IN PACKAGE 'DBMS_SQL.OPEN_CURSOR' IS NOT CURRENTLY SUPPORTED. ***/!!!
'' AS OPEN_CURSOR;
dynamic_statement := 'SELECT * FROM
sample_table';
!!!RESOLVE EWI!!! /*** SSC-EWI-OR0076 - TRANSLATION FOR BUILT-IN PACKAGE 'DBMS_SQL.PARSE' IS NOT CURRENTLY SUPPORTED. ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
DBMS_SQL.PARSE(:c, :dynamic_statement);
END;
$$;
SQL Server¶
CREATE OR ALTER PROCEDURE transact_dynamic_sql
AS
BEGIN
DECLARE @dynamicStatement AS VARCHAR(200);
DECLARE @numericVariable AS VARCHAR(200);
SET @dynamicStatement = 'INSERT INTO sample_table(col1) VALUES(1);';
SET @numericVariable = '3';
EXECUTE (@dynamicStatement);
EXEC ('INSERT INTO sampleTable(col1) VALUES (' + @numericVariable + ');');
EXECUTE ('INSERT INTO sampleTable(col1) VALUES(10);') AS USER = 'DbAdmin';
INSERT INTO sampleTable EXECUTE sp_executesql @statement = 'SELECT * FROM sampleTable;';
INSERT INTO sampleTable EXECUTE ('SELECT * FROM sampleTable;');
END;
CREATE OR REPLACE PROCEDURE transact_dynamic_sql ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": { "major": 0, "minor": 0, "patch": "0" }, "attributes": { "component": "transact", "convertedOn": "11/13/2024", "domain": "test" }}'
EXECUTE AS CALLER
AS
$$
DECLARE
DYNAMICSTATEMENT VARCHAR(200);
NUMERICVARIABLE VARCHAR(200);
BEGIN
DYNAMICSTATEMENT := 'INSERT INTO sample_table (col1) VALUES(1);';
NUMERICVARIABLE := '3';
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE :DYNAMICSTATEMENT;
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!
EXECUTE IMMEDIATE 'INSERT INTO sampleTable (col1) VALUES (' || :NUMERICVARIABLE || ');';
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0021 - EXECUTE AS USER/LOGIN NOT SUPPORTED IN SNOWFLAKE ***/!!!
EXECUTE IMMEDIATE 'INSERT INTO sampleTable (col1) VALUES(10);';
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0073 - PENDING FUNCTIONAL EQUIVALENCE REVIEW FOR 'INSERT WITH EXECUTE' NODE ***/!!!
INSERT INTO sampleTable EXECUTE IMMEDIATE 'SELECT
*
FROM
sampleTable;';
!!!RESOLVE EWI!!! /*** SSC-EWI-0030 - THE STATEMENT BELOW HAS USAGES OF DYNAMIC SQL. ***/!!!!!!RESOLVE EWI!!! /*** SSC-EWI-0073 - PENDING FUNCTIONAL EQUIVALENCE REVIEW FOR 'INSERT WITH EXECUTE' NODE ***/!!!
INSERT INTO sampleTable EXECUTE IMMEDIATE 'SELECT
*
FROM
sampleTable;';
END;
$$;
Issues Inside of Dynamic SQL¶
Something important to take into account is that when migrating dynamic SQL code, SnowConvert will not report any type of issue inside of dynamic SQL in the output code or in the assessment reports. This will happen even when the documentation of an issue or the translation specification describes that an issue will always be added to the output code. Here is an example of a migration in Oracle where this situation might be encountered:
SELECT dbms_random.value() FROM dual;
CREATE OR REPLACE PROCEDURE dynamic_sql_procedure
AS
result VARCHAR(100) := 'SELECT dbms_random.value() from dual';
BEGIN
NULL;
END;
SELECT
--** SSC-FDM-OR0033 - DBMS_RANDOM.VALUE DIGITS OF PRECISION ARE LOWER IN SNOWFLAKE **
DBMS_RANDOM.VALUE_UDF() FROM dual;
CREATE OR REPLACE PROCEDURE dynamic_sql_procedure ()
RETURNS VARCHAR
LANGUAGE SQL
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
EXECUTE AS CALLER
AS
$$
DECLARE
result VARCHAR(100) := 'SELECT
DBMS_RANDOM.VALUE_UDF() from dual';
BEGIN
NULL;
END;
$$;
In the previous example, the query and the variable assignment inside the procedure will be converted exactly the same, the difference is that in the dynamic SQL code the conversion issues will not be shown in the output code and in the assessment reports.
Recommendations¶
Use this tag to track every dynamically built statement and review its correctness when troubleshooting.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0092¶
Deprecated
Severity¶
Low
Description¶
Snowflake Materialized Views have certain limitations mentioned here. Right now, all Materialized Views are being converted to regular Views without the additional clauses they had. In the future, SnowConvert is going to convert the supported cases to Snowflake Materialized Views.
Example Code¶
Input Code:¶
CREATE MATERIALIZED VIEW MATERIALIZED_VIEW1
SEGMENT CREATION IMMEDIATE
ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
INMEMORY PRIORITY NONE MEMCOMPRESS FOR QUERY LOW DISTRIBUTE AUTO NO DUPLICATE
AS
select
*
from
aTable;
Output Code:¶
!!!RESOLVE EWI!!! /*** SSC-EWI-0092 - MATERIALIZED VIEW WAS CONVERTED TO REGULAR VIEW. ***/!!!
CREATE OR REPLACE VIEW MATERIALIZED_VIEW1
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
AS
--** SSC-FDM-0001 - VIEWS SELECTING ALL COLUMNS FROM A SINGLE TABLE ARE NOT REQUIRED IN SNOWFLAKE AND MAY IMPACT PERFORMANCE. **
select
*
from
aTable;
Recommendations¶
No additional user actions are required.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0004¶
Severity¶
Critical
Description¶
This issue appears when occurs an error executing a conversion rule for a specific SCRIPT(bteq…) node in the source code.
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0045¶
Severity¶
Medium
Description¶
In some cases, column names that are valid in the source language may conflict with Snowflake’s reserved keywords. These conflicts arise because Snowflake reserves a set of keywords that cannot be used directly as column names without special handling. For details, refer to Snowflake’s official documentation on reserved and limited keywords.
Code example¶
Input¶
CREATE TABLE T1
(
LOCALTIME VARCHAR,
CURRENT_USER VARCHAR
);
Output¶
CREATE OR REPLACE TABLE T1
(
!!!RESOLVE EWI!!! /*** SSC-EWI-0045 - COLUMN NAME 'LOCALTIME' IS A SNOWFLAKE RESERVED KEYWORD ***/!!!
"LOCALTIME" VARCHAR,
!!!RESOLVE EWI!!! /*** SSC-EWI-0045 - COLUMN NAME 'CURRENT_USER' IS A SNOWFLAKE RESERVED KEYWORD ***/!!!
"CURRENT_USER" VARCHAR
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
;
Recommendations¶
Consider renaming the columns that use names that are not supported in Snowflake.
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0014¶
Severity¶
Critical
Description¶
This error appears when the body of a specific procedure statement is not generated.
Recommendations¶
If you need more support, you can email us at snowconvert-support@snowflake.com
SSC-EWI-0020¶
Severity¶
Low
Summary¶
There are several User-Defined Functions (UDF) provided by SnowConvert used to reproduce source language behaviors that are not supported by Snowflake, functionality and descriptions are detailed below.
UDFs can be found in “UDF Helpers” folder created in the output path after the migration has occurred.
Recommendations¶
Check if the UDF Helpers folder is being created with files inside it.
If you need more support, you can email us at snowconvert-support@snowflake.com