

In this section of the article we will discuss how we can drop an already created synonym. Now as we are aware that if we can create a synonym of an object then in the due course we may need to drop the same synonym. In the previous section of the article, we created the synonym using the CREATE SYNONYM statement. Let us execute and check the result.Īs we can see in the above screenshot that the query returns the rows of the employee table. Let us now execute the query in SQL developer and look at the result.Īs per the screenshot, we can see that the synonym employee_nil has been created.Īs per our discussion in the above section, this query when executed in the SQL developer should return us the result set of the employee table. Let us write a query as now we o not have to prefix the schema name with the table name. After we have created the synonym, now we can use the name employee_nil instead of an employee to access it as it is also created as public. In the above query, the synonym name is employee_nil. Let us first write a query to create a schema for the table employee. In our example we will create a synonym for the table employee which is present in the schema ‘nil’ and after creating the schema we will try to access it from a different schema. Let us now go through an example to understand better. These objects can be table, view, sequence, function, and stored procedure. object_name: This parameter refers to the name of the object for which we are creating the schema.If we omit this parameter then the oracle will think it to be the user’s own schema. schema: This parameter is used to give the schema name.One important point to remember is that the privileges should already be present with the user for the objects to make it public. The term public means that the synonym is applicable or accessible to all users. PUBLIC: This parameter as the name suggests is used to create a synonym that is public.REPLACE: This parameter is used to recreate the same synonym if it already exists the user is not required to drop the existing synonym.Hadoop, Data Science, Statistics & othersĬREATE SYNONYM schema.synonym_name
