In Oracle, you can use the select statement with the "dba_synonyms" query table to query all synonyms. The syntax is "select * from dba_synonyms"; the functions of synonyms and views are similar and are a mapping relationship, which can save a lot of time. Database space.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
Detailed explanation of Oracle's synonyms
Literally understood, it means an alias, which is similar to the function of a view. It is a mapping relationship.
Synonym syntax: CREATE
[PUBLIC] SYNONYM synonym FOR object;
View all synonyms:
select * from dba_synonyms
Extended knowledge:
1: Get all current synonym table names:select table_name from user_synonyms
select table_owner from user_synonyms
select table_owner from user_synonyms WHERE table_name ='大写表名'
select * from 大写所有者名.大写表名
select COLUMN_NAME,DATA_TYPE,DATA_LENGTH from dba_tab_columnswhere table_name ='(大写表名)' AND OWNER = (大写所=属名) order by COLUMN_NAME';
select a.column_name, DECODE(A.column_name, b.column_name, 1, 0) pk from all_tab_columns a, (select column_name from all_constraints c, all_cons_columns col where c.constraint_name = col.constraint_name and c.constraint_type = 'P' and c.table_name = '大写表名' ) b where table_name ='大写表名' and a.column_name = b.column_name(+) and DECODE(A.column_name, b.column_name, 1, 0) = 1
Oracle Video Tutorial"
The above is the detailed content of How to query synonyms of a table in Oracle. For more information, please follow other related articles on the PHP Chinese website!