In what order will Oracle use synonym, view, and table objects?What table/view do you query against to select all the table names in a schema in Oracle?Get list of all tables in Oracle?How can I get column names from a table in Oracle?How do I limit the number of rows returned by an Oracle query after ordering?Managing Oracle SynonymsOracle stored procedure synonyms and grants not working as expectedHow to grant privileges on trigger and synonyms in oracle 11gPrivileges on views/synonyms vs on underlying tablesCannot create SYNONYM in OracleHow to grant “select” permission on public synonym “SHC.ABC” of table “SHC.ABC”

Very lazy puppy

How can I create folders in folders in terminal

What is the origin of the “clerics can create water” trope?

Can Brexit be undone in an emergency?

Floating Point XOR

Is the name of an interval between two notes unique and absolute?

Why do we need to use transistors when building an OR gate?

What was the deeper meaning of Hermione wanting the cloak?

Strength of Female Chimpanzees vs. Male Chimpanzees?

We suspect colleague is stealing company code - what do we do?

Why are there two bearded faces wearing red hats on my stealth bomber icon?

What exactly is a web font, and what does converting to one involve?

Minimum number of lines to draw 111 squares

If people's daily habits are reliable then why is the stock market so unpredictable?

How do rulers get rich from war?

What is the word for a person who destroys monuments?

Compare FEM mesh with the mesh created within Mathematica

Output Distinct Factor Cuboids

Can I separate garlic into cloves for storage?

Is Yang not precluded from conducting his "UBI experiment" as an electoral candidate?

How could artificial intelligence harm us?

Does battery condition have anything to do with macbook pro performance?

Is a global DNS record a security risk for phpMyAdmin?

removing rows containing NA in every column



In what order will Oracle use synonym, view, and table objects?


What table/view do you query against to select all the table names in a schema in Oracle?Get list of all tables in Oracle?How can I get column names from a table in Oracle?How do I limit the number of rows returned by an Oracle query after ordering?Managing Oracle SynonymsOracle stored procedure synonyms and grants not working as expectedHow to grant privileges on trigger and synonyms in oracle 11gPrivileges on views/synonyms vs on underlying tablesCannot create SYNONYM in OracleHow to grant “select” permission on public synonym “SHC.ABC” of table “SHC.ABC”






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















Let's say that my database has the following objects:



  • A table on schema "B" named "mlb_players"

  • A view on schema "C" named "mlb_players" that is a SELECT against a table on server "DB2"

  • A synonym on schema "D" named "mlb_players" that points to a table on server "DB3"

All of these objects are granted to my schema "RedSoxRule"



If I execute this query, from where would the data be retrieved?



SELECT *
FROM mlb_players


In other words, if a given name (in this case "mlb_players") is applicable to different object types, and the GRANTS are equal, in what order will Oracle find the requested object?










share|improve this question
























  • experts-exchange.com/questions/28343488/…

    – Robert Kock
    Mar 28 at 14:01






  • 3





    @RobertKock - the whole and entire purpose of StackOverflow is to save developers from visiting that site and its pernicious paywall.

    – APC
    Mar 28 at 14:03

















1















Let's say that my database has the following objects:



  • A table on schema "B" named "mlb_players"

  • A view on schema "C" named "mlb_players" that is a SELECT against a table on server "DB2"

  • A synonym on schema "D" named "mlb_players" that points to a table on server "DB3"

All of these objects are granted to my schema "RedSoxRule"



If I execute this query, from where would the data be retrieved?



SELECT *
FROM mlb_players


In other words, if a given name (in this case "mlb_players") is applicable to different object types, and the GRANTS are equal, in what order will Oracle find the requested object?










share|improve this question
























  • experts-exchange.com/questions/28343488/…

    – Robert Kock
    Mar 28 at 14:01






  • 3





    @RobertKock - the whole and entire purpose of StackOverflow is to save developers from visiting that site and its pernicious paywall.

    – APC
    Mar 28 at 14:03













1












1








1








Let's say that my database has the following objects:



  • A table on schema "B" named "mlb_players"

  • A view on schema "C" named "mlb_players" that is a SELECT against a table on server "DB2"

  • A synonym on schema "D" named "mlb_players" that points to a table on server "DB3"

All of these objects are granted to my schema "RedSoxRule"



If I execute this query, from where would the data be retrieved?



SELECT *
FROM mlb_players


In other words, if a given name (in this case "mlb_players") is applicable to different object types, and the GRANTS are equal, in what order will Oracle find the requested object?










share|improve this question














Let's say that my database has the following objects:



  • A table on schema "B" named "mlb_players"

  • A view on schema "C" named "mlb_players" that is a SELECT against a table on server "DB2"

  • A synonym on schema "D" named "mlb_players" that points to a table on server "DB3"

All of these objects are granted to my schema "RedSoxRule"



If I execute this query, from where would the data be retrieved?



SELECT *
FROM mlb_players


In other words, if a given name (in this case "mlb_players") is applicable to different object types, and the GRANTS are equal, in what order will Oracle find the requested object?







oracle oracle11g






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 13:52









Jeromy FrenchJeromy French

9,26710 gold badges60 silver badges107 bronze badges




9,26710 gold badges60 silver badges107 bronze badges















  • experts-exchange.com/questions/28343488/…

    – Robert Kock
    Mar 28 at 14:01






  • 3





    @RobertKock - the whole and entire purpose of StackOverflow is to save developers from visiting that site and its pernicious paywall.

    – APC
    Mar 28 at 14:03

















  • experts-exchange.com/questions/28343488/…

    – Robert Kock
    Mar 28 at 14:01






  • 3





    @RobertKock - the whole and entire purpose of StackOverflow is to save developers from visiting that site and its pernicious paywall.

    – APC
    Mar 28 at 14:03
















experts-exchange.com/questions/28343488/…

– Robert Kock
Mar 28 at 14:01





experts-exchange.com/questions/28343488/…

– Robert Kock
Mar 28 at 14:01




3




3





@RobertKock - the whole and entire purpose of StackOverflow is to save developers from visiting that site and its pernicious paywall.

– APC
Mar 28 at 14:03





@RobertKock - the whole and entire purpose of StackOverflow is to save developers from visiting that site and its pernicious paywall.

– APC
Mar 28 at 14:03












2 Answers
2






active

oldest

votes


















3
















Oracle has a nice long explanation of this.



Basically, when resolving a name, it looks:



  1. For objects in your schema with that name

  2. For public synonyms with that name

  3. If the name has multiple parts (e.g. C.mlb_players, it checks to see if the first part is a qualifying schema that you have access to.

In your example, Oracle won't find any of them. They're all in different schemas from your RedSoxRule schema, none of them are public synonyms, and you didn't qualify mlb_players with a schema name.



It doesn't actually matter what the type of the object is (table, view, synonym, package, etc) - they're all treated the same.






share|improve this answer
































    2

















    If I execute this query, from where would the data be retrieved




    Nowhere. REDSOXRULE has no object called mlb_players so the query would fail with ORA-00942: table or view does not exist.



    You would need to prefix the table name with the schema you're prefixing, e.g.



    SELECT *
    FROM d.mlb_players;


    Let's suppose you have a variation on your posted structure.



    1. REDSOXRULE has a view mlb_players for a.mlb_players. The query select * from mlb_players would select from this view, i.e from a.mlb_players.

    2. Instead of a view REDSOXRULE has a private synonym mlb_players for b.mlb_players. The query select * from mlb_players would select from this synonym, i.e from b.mlb_players. Note that you can't have a private synonym with the same name as a table or view in your schema.

    3. Instead of a private synonym the database has a public synonym mlb_players for d.mlb_players. The query select * from mlb_players would select from this publicsynonym, i.e from d.mlb_players.

    That is, Oracle looks first for objects owned by the schema (tables, views, private synonyms, etc). Then it looks at public synonyms. Then it looks for objects in other schemas






    share|improve this answer





























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );














      draft saved

      draft discarded
















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55399315%2fin-what-order-will-oracle-use-synonym-view-and-table-objects%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3
















      Oracle has a nice long explanation of this.



      Basically, when resolving a name, it looks:



      1. For objects in your schema with that name

      2. For public synonyms with that name

      3. If the name has multiple parts (e.g. C.mlb_players, it checks to see if the first part is a qualifying schema that you have access to.

      In your example, Oracle won't find any of them. They're all in different schemas from your RedSoxRule schema, none of them are public synonyms, and you didn't qualify mlb_players with a schema name.



      It doesn't actually matter what the type of the object is (table, view, synonym, package, etc) - they're all treated the same.






      share|improve this answer





























        3
















        Oracle has a nice long explanation of this.



        Basically, when resolving a name, it looks:



        1. For objects in your schema with that name

        2. For public synonyms with that name

        3. If the name has multiple parts (e.g. C.mlb_players, it checks to see if the first part is a qualifying schema that you have access to.

        In your example, Oracle won't find any of them. They're all in different schemas from your RedSoxRule schema, none of them are public synonyms, and you didn't qualify mlb_players with a schema name.



        It doesn't actually matter what the type of the object is (table, view, synonym, package, etc) - they're all treated the same.






        share|improve this answer



























          3














          3










          3









          Oracle has a nice long explanation of this.



          Basically, when resolving a name, it looks:



          1. For objects in your schema with that name

          2. For public synonyms with that name

          3. If the name has multiple parts (e.g. C.mlb_players, it checks to see if the first part is a qualifying schema that you have access to.

          In your example, Oracle won't find any of them. They're all in different schemas from your RedSoxRule schema, none of them are public synonyms, and you didn't qualify mlb_players with a schema name.



          It doesn't actually matter what the type of the object is (table, view, synonym, package, etc) - they're all treated the same.






          share|improve this answer













          Oracle has a nice long explanation of this.



          Basically, when resolving a name, it looks:



          1. For objects in your schema with that name

          2. For public synonyms with that name

          3. If the name has multiple parts (e.g. C.mlb_players, it checks to see if the first part is a qualifying schema that you have access to.

          In your example, Oracle won't find any of them. They're all in different schemas from your RedSoxRule schema, none of them are public synonyms, and you didn't qualify mlb_players with a schema name.



          It doesn't actually matter what the type of the object is (table, view, synonym, package, etc) - they're all treated the same.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 14:11









          kfinitykfinity

          4,2051 gold badge7 silver badges14 bronze badges




          4,2051 gold badge7 silver badges14 bronze badges


























              2

















              If I execute this query, from where would the data be retrieved




              Nowhere. REDSOXRULE has no object called mlb_players so the query would fail with ORA-00942: table or view does not exist.



              You would need to prefix the table name with the schema you're prefixing, e.g.



              SELECT *
              FROM d.mlb_players;


              Let's suppose you have a variation on your posted structure.



              1. REDSOXRULE has a view mlb_players for a.mlb_players. The query select * from mlb_players would select from this view, i.e from a.mlb_players.

              2. Instead of a view REDSOXRULE has a private synonym mlb_players for b.mlb_players. The query select * from mlb_players would select from this synonym, i.e from b.mlb_players. Note that you can't have a private synonym with the same name as a table or view in your schema.

              3. Instead of a private synonym the database has a public synonym mlb_players for d.mlb_players. The query select * from mlb_players would select from this publicsynonym, i.e from d.mlb_players.

              That is, Oracle looks first for objects owned by the schema (tables, views, private synonyms, etc). Then it looks at public synonyms. Then it looks for objects in other schemas






              share|improve this answer































                2

















                If I execute this query, from where would the data be retrieved




                Nowhere. REDSOXRULE has no object called mlb_players so the query would fail with ORA-00942: table or view does not exist.



                You would need to prefix the table name with the schema you're prefixing, e.g.



                SELECT *
                FROM d.mlb_players;


                Let's suppose you have a variation on your posted structure.



                1. REDSOXRULE has a view mlb_players for a.mlb_players. The query select * from mlb_players would select from this view, i.e from a.mlb_players.

                2. Instead of a view REDSOXRULE has a private synonym mlb_players for b.mlb_players. The query select * from mlb_players would select from this synonym, i.e from b.mlb_players. Note that you can't have a private synonym with the same name as a table or view in your schema.

                3. Instead of a private synonym the database has a public synonym mlb_players for d.mlb_players. The query select * from mlb_players would select from this publicsynonym, i.e from d.mlb_players.

                That is, Oracle looks first for objects owned by the schema (tables, views, private synonyms, etc). Then it looks at public synonyms. Then it looks for objects in other schemas






                share|improve this answer





























                  2














                  2










                  2










                  If I execute this query, from where would the data be retrieved




                  Nowhere. REDSOXRULE has no object called mlb_players so the query would fail with ORA-00942: table or view does not exist.



                  You would need to prefix the table name with the schema you're prefixing, e.g.



                  SELECT *
                  FROM d.mlb_players;


                  Let's suppose you have a variation on your posted structure.



                  1. REDSOXRULE has a view mlb_players for a.mlb_players. The query select * from mlb_players would select from this view, i.e from a.mlb_players.

                  2. Instead of a view REDSOXRULE has a private synonym mlb_players for b.mlb_players. The query select * from mlb_players would select from this synonym, i.e from b.mlb_players. Note that you can't have a private synonym with the same name as a table or view in your schema.

                  3. Instead of a private synonym the database has a public synonym mlb_players for d.mlb_players. The query select * from mlb_players would select from this publicsynonym, i.e from d.mlb_players.

                  That is, Oracle looks first for objects owned by the schema (tables, views, private synonyms, etc). Then it looks at public synonyms. Then it looks for objects in other schemas






                  share|improve this answer
















                  If I execute this query, from where would the data be retrieved




                  Nowhere. REDSOXRULE has no object called mlb_players so the query would fail with ORA-00942: table or view does not exist.



                  You would need to prefix the table name with the schema you're prefixing, e.g.



                  SELECT *
                  FROM d.mlb_players;


                  Let's suppose you have a variation on your posted structure.



                  1. REDSOXRULE has a view mlb_players for a.mlb_players. The query select * from mlb_players would select from this view, i.e from a.mlb_players.

                  2. Instead of a view REDSOXRULE has a private synonym mlb_players for b.mlb_players. The query select * from mlb_players would select from this synonym, i.e from b.mlb_players. Note that you can't have a private synonym with the same name as a table or view in your schema.

                  3. Instead of a private synonym the database has a public synonym mlb_players for d.mlb_players. The query select * from mlb_players would select from this publicsynonym, i.e from d.mlb_players.

                  That is, Oracle looks first for objects owned by the schema (tables, views, private synonyms, etc). Then it looks at public synonyms. Then it looks for objects in other schemas







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 28 at 14:17

























                  answered Mar 28 at 14:10









                  APCAPC

                  126k17 gold badges128 silver badges239 bronze badges




                  126k17 gold badges128 silver badges239 bronze badges































                      draft saved

                      draft discarded















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55399315%2fin-what-order-will-oracle-use-synonym-view-and-table-objects%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript