Thursday, 17 August 2017

SAP HANA: Synonyms

Description

v  The CREATE SYNONYM creates an alternate name for a table, view, procedure or sequence.

v  You can use a synonym to re-point functions and stored procedures to differing tables, views or sequences without needing to re-write the function or stored procedure.

v  The optional PUBLIC element allows for the creation of a public synonym. A public synonym can be accessed by any users, but the users that have proper privilege on its base object can access the base object.
Syntax

 CREATE [PUBLIC] SYNONYM <synonym_name> FOR <object_name>

EXAMPLE:
create synonym "KABIL_PRACTICE"."CUSTOMER" for "KABIL_PRACTICE"."CUSTOMER_SAP_STUDENT";

We can access the synonym from the Synonyms folder under the specified Schema.

To Create Public Synonym:

create Public synonym "CUSTOMER_KABIL" for "KABIL_PRACTICE"."CUSTOMER_SAP_STUDENT";

We can access the synonym from the Public Synonyms folder under the Catalog.

To Drop Synonym:

Drop synonym "KABIL_PRACTICE"."CUSTOMER";


Drop public synonym "CUSTOMER_KABIL";




No comments:

Post a Comment