In this page you could find information about Synonyms.
Some parts in the output code are omitted for clarity reasons.
Create Synonym
Synonyms are not supported in Snowflake. The references to the Synonyms will be changed for the original Object.
Input Code:
IN -> Oracle_01.sql
CREATEORREPLACESYNONYM B.TABLITA_SYNONYM FOR TABLITA;
Output Code:
OUT -> Oracle_01.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 B.TABLITA_SYNONYM FOR TABLITA ;
Example 1: Synonym that refers to a table.
Oracle source code:
IN -> Oracle_02.sql
CREATETABLETABLITA( COLUMN1 NUMBER);CREATEORREPLACESYNONYM B.TABLITA_SYNONYM FOR TABLITA;SELECT*FROM B.TABLITA_SYNONYM WHERE B.TABLITA_SYNONYM.COLUMN1 =20;
Snowflake migrated code: you'll notice that the SELECT originally refers to a synonym, but now it refers to the table that points the synonym.
OUT -> Oracle_02.sql
CREATE OR REPLACETABLETABLITA ( COLUMN1 NUMBER(38, 18) /*** SSC-FDM-0006 - NUMBER TYPE COLUMN MAY NOT BEHAVE SIMILARLY IN SNOWFLAKE. ***/ ) 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 B.TABLITA_SYNONYM FOR TABLITA ;SELECT*FROM TABLITAWHERE TABLITA.COLUMN1 =20;
Example 2: Synonym that refers to another synonym.
Oracle source code:
IN -> Oracle_03.sql
CREATETABLETABLITA( COLUMN1 NUMBER);CREATEORREPLACESYNONYM B.TABLITA_SYNONYM FOR TABLITA;CREATEORREPLACESYNONYM C.TABLITA_SYNONYM2 FOR B.TABLITA_SYNONYM;SELECT*FROM C.TABLITA_SYNONYM2 WHERE C.TABLITA_SYNONYM2.COLUMN1 =20;UPDATE C.TABLITA_SYNONYM2 SET COLUMN1 =10;INSERT INTO C.TABLITA_SYNONYM2 VALUES (1);
Snowflake migrated code: you'll notice that originally the SELECT , UPDATE, INSERT refers to a synonym, and now it refers to the atomic object, which is a table.
OUT -> Oracle_03.sql
CREATE OR REPLACETABLETABLITA ( COLUMN1 NUMBER(38, 18) /*** SSC-FDM-0006 - NUMBER TYPE COLUMN MAY NOT BEHAVE SIMILARLY IN SNOWFLAKE. ***/ ) 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 B.TABLITA_SYNONYM FOR TABLITA ;-- --** SSC-FDM-OR0005 - SYNONYMS NOT SUPPORTED IN SNOWFLAKE BUT REFERENCES TO THIS SYNONYM WERE CHANGED BY THE ORIGINAL OBJECT NAME. **
--CREATE OR REPLACE SYNONYM C.TABLITA_SYNONYM2 FOR B.TABLITA_SYNONYM ;SELECT*FROM TABLITAWHERE TABLITA.COLUMN1 =20;UPDATE TABLITASET COLUMN1 =10;INSERT INTO TABLITAVALUES (1);
Example 3: Synonym that refers to a view
Oracle Source Code
IN -> Oracle_04.sql
CREATEORREPLACESYNONYM B.TABLITA_SYNONYM FOR TABLITA;CREATEORREPLACESYNONYM C.TABLITA_SYNONYM2 FOR B.TABLITA_SYNONYM;CREATEVIEWVIEW_ORGINALASSELECT*FROM C.TABLITA_SYNONYM2;CREATEORREPLACESYNONYM VIEW_SYNONYM FOR VIEW_ORGINAL;SELECT*FROM VIEW_SYNONYM;
Snowflake migrated code: you'll notice that the SELECT originally refers to a synonym, and now it refers to the atomic objects, which is a view.
OUT -> Oracle_04.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 B.TABLITA_SYNONYM FOR TABLITA ;----** SSC-FDM-OR0005 - SYNONYMS NOT SUPPORTED IN SNOWFLAKE BUT REFERENCES TO THIS SYNONYM WERE CHANGED BY THE ORIGINAL OBJECT NAME. **
--CREATE OR REPLACE SYNONYM C.TABLITA_SYNONYM2 FOR B.TABLITA_SYNONYM ;CREATE OR REPLACEVIEWVIEW_ORGINALCOMMENT = '{"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*FROMTABLITA;----** SSC-FDM-OR0005 - SYNONYMS NOT SUPPORTED IN SNOWFLAKE BUT REFERENCES TO THIS SYNONYM WERE CHANGED BY THE ORIGINAL OBJECT NAME. **
--CREATE OR REPLACE SYNONYM VIEW_SYNONYM FOR VIEW_ORGINAL ;SELECT*FROMVIEW_ORGINAL;