For more information check the Synonym translation reference.
Synonyms used inside PL/SQL blocks are changed to the referenced object and the Schema will be added if necessary.
Implicit Schema added
When the procedure or function is inside a schema and the synonym is inside that schema, but it is being used without the schema, the converted code will add the schema.
Oracle
IN -> Oracle_01.sql
CREATETABLEschema_one.TABLE_TEST1( COL1 INTEGER, COL2 DATEDEFAULTSYSDATE );CREATEORREPLACESYNONYM schema_one.MY_SYNONYM1 FOR schema_one.TABLE_TEST1;createorreplaceprocedure schema_one.procedure1 asreturnval integer;beginselect col1 into returnval from my_synonym1;end;
Snowflake
OUT -> Oracle_01.sql
CREATE OR REPLACETABLEschema_one.TABLE_TEST1 ( COL1 INTEGER, COL2 TIMESTAMP /*** SSC-FDM-OR0042 - DATE TYPE COLUMN HAS A DIFFERENT BEHAVIOR IN SNOWFLAKE. ***/ DEFAULT CURRENT_TIMESTAMP()
) COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
;-- --** SSC-FDM-OR0005 - SYNONYMS NOT SUPPORTED IN SNOWFLAKE BUT REFERENCES TO THIS SYNONYM WERE CHANGED BY THE ORIGINAL OBJECT NAME. **
-- CREATE OR REPLACE SYNONYM schema_one.MY_SYNONYM1 FOR schema_one.TABLE_TEST1 ;CREATEORREPLACEPROCEDURE schema_one.procedure1 ()RETURNSVARCHARLANGUAGESQL COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},"attributes":{"component":"oracle"}}'
EXECUTEASCALLERAS $$DECLARE returnval integer;BEGINselect col1 into :returnvalfrom schema_one.TABLE_TEST1;END; $$;
Schema of referenced object added
When the synonym references an object that is in a specific schema, the schema name will be added to the referenced object.
Oracle
IN -> Oracle_02.sql
--Additional Params: -t JavaScriptCREATEORREPLACESYNONYM MY_SYNONYM2 FOR schema_one.TABLE_TEST1;createorreplaceprocedure procedure2 asreturnval integer;beginselect col1 into returnval from my_synonym2;end;
Snowflake
OUT -> Oracle_02.sql
----** SSC-FDM-OR0005 - SYNONYMS NOT SUPPORTED IN SNOWFLAKE BUT REFERENCES TO THIS SYNONYM WERE CHANGED BY THE ORIGINAL OBJECT NAME. **
--CREATE OR REPLACE SYNONYM MY_SYNONYM2 FOR schema_one.TABLE_TEST1 ;CREATEORREPLACEPROCEDURE procedure2 ()RETURNS STRINGLANGUAGE JAVASCRIPTCOMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"oracle"}}'
EXECUTEASCALLERAS$$// SnowConvert Helpers Code section is omitted. let RETURNVAL; [RETURNVAL] =EXEC(`SELECT col1from schema_one.TABLE_TEST1`);$$;
Related EWIs
SSC-FDM-OR0005: Synonyms are not supported in Snowflake but references to this synonym were changed by the original object name.
SSC-FDM-OR0042: Date Type Transformed To Timestamp Has A Different Behavior.