Name: Create Oracle synonym

Author: Rob Vonk

Language: Oracle

Description:
Create a synonym to a table in another schema. SCHEMA_1 is the schema where the original schema exists. SCHEMA_2 is the schema where you want to use the table. The name of the user is the same as the schema name (SCHEMA_2).

Snippet:

ALTER SESSION SET CURRENT_SCHEMA = SCHEMA_1

CREATE SYNONYM SCHEMA_2.MY_TABLE FOR MY_TABLE

GRANT SELECT ON  MY_TABLE TO SCHEMA_2