[oracle] 同义词的创建、删除、查询

I:什么是同义词?

相当于alias(别名),比如把user1.table1在user2中建一个同义词table1 create synonym table1 for user1.table1; 这样当你在user2中查select * from table1时就相当于查select * from user1.table1;

 II:如何创建,删除,查看同义词?

1.在user用户中给当前用户(user2)授权: grant select/delete/update on user2

创建同义词:
create public synonym table_name for user.table_name;

2.删除同义词:

drop public synonym table_name;

3.查看所有同义词:

select * from dba_synonyms

原文地址:https://www.cnblogs.com/kentyouyou/p/3282129.html