Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:56:49+00:00 2026-06-09T12:56:49+00:00

Is there a way, to select data only form the own schema, even if

  • 0

Is there a way, to select data only form the own schema, even if there is an public synonym?

something like: Select * from current_schema.Table1

more info:

I got a public synonym on table1 on schema1.
now I have a package(on schema2) that selects table1, I want to select table1 of schema2 not schema1.
My problem is, I dont what the user to change the identifier when he uses the package at his server.

edit
I see my question is not clear, what i wanted to know is is there a placeholder for my current schema?

at the moment i need to do this:
Select * from schema2.Table1

and i want is something Like this :
Select * from MySchema.Table1
or
Select * from this.Table1
or
Select * from current_schema.Table1

does something like this exists in oracle?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:56:50+00:00Added an answer on June 9, 2026 at 12:56 pm

    The scoping rules are quite clear. When the databse parses a query it looks for objects matching the identifiers in your statement in the following order of precedence:

    1. objects of that name in your schema
    2. private synonyms of that name (in your schema)
    3. public synonys of that name

    But if you want to be clear certainly you can prefix your table references with the specific schema name. That is helpful in communicating your intent to others looking at your code.

    Furthermore, if you have a table TABLE1 in your schema and there is a public synonym called TABLE1 pointing at a table in another schema which you want to query instead you must prefix your reference with that other schema.


    “what i wanted to know is is there a placeholder for my current
    schema”

    No, because it’s not necessary. The default is always your current schema. That is, this statement …

    SQL>  select * from t23;
    

    … will always select from T23 in your current schema, if it has a table (or a private synonym) with that name.

    Note that it is possible to change the value of your current schema, with the ALTER SESSION command:

    SQL>  alter session set current_schema=scott;
    

    Now if you executed the previous select it would return results from SCOTT.T23 providing the SCOTT schema had such a table, and taht you had privileges on it. You can find out more about Oracle schemas in a blog piece I wrote a while back.


    I was trying to understand what problem you were having, and I noticed that your scenario is one user executing a package owned by another user. Now, by default a package owned by SCHEMA2 will run against objects owned by SCHEMA2 and use the privileges on other objects granted to SCHEMA2.

    But PL/SQL offers us the ability to change that: the AUTHID clause determines whether the package runs with the definer’s privileges (that is the package owner) or invoker’s privileges (the current user. So if SCHEMA2 defined their package with AUTHID CURRENT_USER when SCHEMA1 runs it the instance of TABLE2 will be the one in scope of SCHEMA1, which would be the one owned by SCHEMA1 or the one indicated by a public synonym.

    Find out more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to select all columns of a data frame except a
Is there any way to select only innermost tables? That is ones that do
1) Is there any way to select a random record from Freebase? If I
Possible Duplicate: How to only select numeric data from mysql? I have a column
The typical way of selecting data is: select * from my_table But what if
Is there a way to select all id's with jQuery with a prefix my
Is there a way to select the jQuery active tab with a HTML propertys.
Is there any way to select items in a list that aren't contained in
Is there a way to select all the contents of a node in Nokogiri?
In a jquery modal dialog, is there a way to select a button as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.