Pages

Monday, December 17, 2012

Synonyms in PL/SQL

Hi falks,

In pl/sql synonym refers to schema objects which are created by a particular user to access an objects which  didn't belongs to him.Sometimes we have to join certain modules of a product to retrieve data for business purposes. Normally the particular user has to create the synonym for the related object according to the data requirement. The owner of the object should give grants for this user. 

Owner can create synonyms and give grants to other users who are using different schema s.

User cannot create a synonym for different schema other than his own schema from different schema other than his own schema.

Example statement of creating synonym from different schema for a certain table. Just imagine that your schema is ABC and other schema which include the table you want is DEF and table is employees. Statement is,

      CREATE OR REPLACE PUBLIC SYNONYM synemployees FOR ABC.employees;

User don't have to give any kind of grants to the synonym for his schema. It will assign all the grants automatically when synonym is creates.
But user can give grants to other users (schemas) while creating the synonym.

No comments:

Post a Comment