1 Reply Latest reply on Jan 14, 2016 8:58 PM by rp0428

    How to pull the table owner

    2811145

      In the application we are using having the schema name different on each environment. I am creating the report and the SQL query should be same for all the environment. As the schema name is different in each environment, I am trying to write a query to pull schema name to append it before the table name.

       

      1. E.g.

      Owner schema: dev_db

      Reporting Schema: report_db

      Table Name: Catalog

      Query: select * from catalog.

       

        I wanted to bind the owner value (select owner  from all_tables where table_name = 'CATALOG') to the reporting query.

        • 1. Re: How to pull the table owner

          This forum is for Sql Developer questions only.

           

          Please mark the thread ANSWERED and repost it in the SQL  forum

          SQL & PL/SQL

           

          You do NOT need to provide the schema name if you are connected to the schema you query from.

           

          Either create public synonyms to use for those objects or simply create a reporting view that handles the schema for you.

           

          You can NOT dynamically change the schema  using SQL. That requires PL/SQL.