Search code examples
javasqloracle-databasejdbcoracle-xe

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


I have Workspace/Schema EDUCATION in Oracle XE.

In my Java code I want execute queries like this: SELECT * FROM Table instead of SELECT * FROM EDUCATION.Table.

When I write query without EDUCATION I have error: table or view does not exist.

I tried to set the default schema to % (screenshot), but it did not help. enter image description here

How to avoid writing Workspace/Schema name?


Solution

  • 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.