What is the method to create a synonym in Oracle?

In Oracle, you can use the CREATE SYNONYM statement to create a synonym. The syntax is as follows:

CREATE SYNONYM synonym_name
   FOR object_name;

In this case, the synonym_name is the name of the synonym you want to create, and the object_name is the name of the object that the synonym references. For example, to create a synonym “my_table” referencing the table “my_schema.my_table”, you can use the following statement:

CREATE SYNONYM my_table
   FOR my_schema.my_table;

When you refer to “my_table” using a synonym, you are actually referencing the table “my_schema.my_table”.

bannerAds