Note
This view is available starting with V2.2.30.
Purpose
This view displays the synonyms of the current user.
Applicability
This view is applicable only to OceanBase Database in Oracle-compatible mode.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| SYNONYM_NAME | VARCHAR2(128) | NO | The name of the synonym. |
| TABLE_OWNER | VARCHAR2(128) | NO | The name of the object referenced by the synonym. In this case, TABLE_NAME is merely a column name. A synonym can also be for another object, such as a view. |
| TABLE_NAME | VARCHAR2(128) | NO | The name of the object referenced by the synonym. |
| DB_LINK | VARCHAR2(128) | NO | The name of the DB link if the synonym references a DB link. |
Sample query
Query all synonyms of the current user.
obclient [SYS]> SELECT * FROM SYS.USER_SYNONYMS;
The query result is as follows:
+--------------+-------------+------------+---------+---------------+
| SYNONYM_NAME | TABLE_OWNER | TABLE_NAME | DB_LINK | ORIGIN_CON_ID |
+--------------+-------------+------------+---------+---------------+
| S1 | SYS | TEST | NULL | 0 |
+--------------+-------------+------------+---------+---------------+
1 row in set
References
Query all synonyms in the current tenant: ALL_SYNONYMS
Query all synonyms in the current tenant: DBA_SYNONYMS
For more information about synonyms, see Manage synonyms.