Creates a synonym.


        FOR object_schema.object_name[@dblink_name];


The CREATE SYNONYM command creates a synonym for specific types of database objects. PolarDB-O support synonyms for the following types of database objects:

  • Tables
  • Views
  • Materialized views
  • Sequences
  • Stored procedures
  • Stored functions
  • Types
  • Objects that are accessible through a database link
  • Other synonyms


Parameter Description
syn_name The name of the synonym. A synonym name must be unique within a schema.
schema The name of the schema where the synonym resides. If you do not specify a schema name, the synonym is created in the first existing schema in your search path.
object_name The name of the object.
object_schema The name of the schema where the referenced object resides.
dblink_name The name of the database link through which an object is accessed.

You can use the REPLACE clause to replace an existing synonym definition with a new synonym definition.

You can use the PUBLIC clause to create the synonym in the public schema. The PUBLIC SYNONYM command is compatible with Oracle databases. You can use this command to create a synonym that resides in the public schema.

CREATE [OR REPLACE] PUBLIC SYNONYM syn_name FOR object_schema.object_name;

The following statement is a short form:

CREATE [OR REPLACE] SYNONYM public.syn_name FOR object_schema.object_name;


Access to the object referenced by the synonym is determined by the permissions of the current user. The synonym user must have proper permissions on the underlying database object.


Create a synonym for the emp table in a schema named polardb:

CREATE SYNONYM personnel FOR polardb.emp;