0

I am using following syntax for creating a private synonym of a table in 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.

Peter Lang
  • 54,264
  • 27
  • 148
  • 161
user1466466
  • 1,206
  • 5
  • 15
  • 19

2 Answers2

4

Just omit the private keyword.

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.

Peter Lang
  • 54,264
  • 27
  • 148
  • 161
2

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.TABLE or TABLE are synonym name.

Here there is a lot of examples.

Robert
  • 25,425
  • 8
  • 67
  • 81
  • 1
    where the word SCHEMA has the oracle notation of schema (http://stackoverflow.com/questions/880230/difference-between-a-user-and-a-schema-in-oracle)... and it does not stand for "tablespace" – sataniccrow May 27 '13 at 13:30