I have created public synonym as suggested in my other question about creating view at system level. Having said that I have created individual public synonym out of the view so that I don’t have to connect to the individual domain anymore. My problem now is how to create a master kind of public synonym to capture all those synonyms which I have created earlier. To what extent the “for” statement can be used?
Example:
At system level, I will run query for each domain where MYVIEW is created :
Create or replace public synonym domain1_myview for domain1.myview;
Create or replace public synonym domain2_myview for domain2.myview;
Create or replace public synonym domain3_myview for domain3.myview;
Then I have 3 public synonym above.
Then I tried writing statement (out of desperation – not as expert) like below hoping to have just ONE Master_MYVIEW but failed:
Create or replace public synonym MASTER_MYVIEW for (select * from domain1_myview union all select * from domain2_myview union all select * from domain3_myview);
The error with the above : “ORA-00995: missing or invalid synonym identifier”
Hope someone can assist me on this task. Have a nice 🙂 day.
Try creating a view called MASTER_MYVIEW first (you may need to deal with privileges there as well):
Then create a public synonym for that new view: