Translate

Synonyms In ORACLE

Why we use Synonyms in ORACLE?

A Synonym is an alias for any table, view, materialized view, sequence, procedure, function, or package.
  • A Public Synonym is owned by the user group PUBLIC and every user in a database can access it.
  • A Private Synonym is in the schema of a specific user who has control over its availability to others.
Synonyms are used to –
  • Mask the real name and owner of a schema object 
  • Provide global (public) access to a schema object
  • Provide location transparency for tables, views, or program units of a remote database.
  • Simplify SQL statements for database users
Example. To query the table EMPLOYEE_INSURANCE with SQL:

SELECT * FROM PRODCRM.EMPLOYEE_INSURANCE;

Now Create Public Synonym for the above Table :

CREATE PUBLIC SYNONYM Insurance FOR PRODCRM.EMPLOYEE_INSURANCE;

After the public synonym is created, you can query with a simple SQL statement:

SELECT * FROM Insurance;



Get involved and leave your Comments in the Box Below. The more people get involved, the more we all benefit.
So, leave your thoughts before you leave the page. 

4 comments:

  1. When we drop a table, synonym is not automatically dropped. One has to take care of such a scenario.

    ReplyDelete
  2. All synonyms for a dropped table remain, but return an error when used..

    Regards,
    Fahad

    ReplyDelete
  3. HELLO, THANK YOU FOR VISITING MY BLOG.

    ENJOYED READING MY ARTICLE?

    kindly Support by sharing this and making donation to :

    BITCOIN : bc1qgkncx8pfu24cn8gzf4wpqv7fk5v0nvp4wm95pk

    ETHER: 0x14e41D03e09Af44EeF505bb265C616075B5b668b

    SHIBA INU: 0x14e41D03e09Af44EeF505bb265C616075B5b668b

    BTT: 0x14e41D03e09Af44EeF505bb265C616075B5b668b


    OTHER CURRENCY TO OUR MULTI COIN WALLET :0x14e41D03e09Af44EeF505bb265C616075B5b668b

    ReplyDelete