简体   繁体   English

如何在Oracle SQL查询中不写模式名称?

[英]How to don't write schema name in oracle sql query?

I have Workspace/Schema EDUCATION in Oracle XE. 我在Oracle XE中进行了工作区/架构EDUCATION

In my Java code I want execute queries like this: SELECT * FROM Table instead of SELECT * FROM EDUCATION.Table . 在我的Java代码中,我想执行如下查询: SELECT * FROM Table而不是SELECT * FROM EDUCATION.Table

When I write query without EDUCATION I have error: table or view does not exist. 当我写查询,而不EDUCATION我有错误:表或视图不存在。

I tried to set the default schema to % (screenshot), but it did not help. 我试图将默认架构设置为%(屏幕截图),但没有帮助。 在此处输入图片说明

How to avoid writing Workspace/Schema name? 如何避免写Workspace / Schema名称?

If I understand correctly, you want to access tables in other schemas without using the schema name. 如果我理解正确,则希望不使用模式名称访问其他模式中的表。

One simple way to do this uses synonyms . 一种简单的方法是使用同义词 In the schema you are connect to: 在模式中,您将连接到:

create synonym table for education.table;

Then you can use table where you would use education.table . 然后,您可以在使用education.table地方使用table

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM