在 oracle 10G 中编写私有同义词的语法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12384331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:06:10  来源:igfitidea点击:

what is syntax for writing a private synonym in oracle 10G?

sqloracleoracle10g

提问by user1466466

I am using following syntax for creating a private synonym of a table in oracle 10G:

我使用以下语法在 oracle 10G 中创建表的私有同义词:

create private synonym <synonym name>
for <schema name>.<table name>;

I am getting this error:

我收到此错误:

ERROR at line 1:
ORA-00905: missing keyword

Please guide me with correct syntax . I did research however i found syntax for public synonym only.

请用正确的语法指导我。我做了研究,但是我发现只有公共同义词的语法。

回答by Peter Lang

Just omit the privatekeyword.

只需省略private关键字。

From the documentation:

文档

CREATE [ OR REPLACE ] [ PUBLIC ] SYNONYM
   [ schema. ]synonym 
   FOR [ schema. ]object [ @ dblink ] ;

PUBLIC
If you omit this clause, then the synonym is private and is accessible only within its schema. A private synonym name must be unique in its schema.

PUBLIC
如果省略此子句,则同义词是私有的,只能在其架构内访问。私有同义词名称在其架构中必须是唯一的。

回答by Robert

It works for me:

这个对我有用:

create or replace synonym SCHEMA1.TABLE for SCHEMA2.TABLE;

or for your schema

或为您的架构

create or replace synonym TABLE for SCHEMA2.TABLE;

where SCHEMA1.TABLEor TABLEare synonym name.

whereSCHEMA1.TABLETABLEare 同义词名称。

Herethere is a lot of examples.

这里有很多例子。