Schema Name Question

Dear all,
I am new to Oracle DB.
Currently I face a problem:
In the same database, I have create the 3 schema and have the following tables:
Schema A: Table123
Schema B: Table123
Schema C: Table456
And under the Schema C, when I select the table Table123,
(Select * from Table123), I get the data from Schema A by default. How can I config my oracle such that I will get the result from the Table123 in schema B when executing (Select * from Table123), without specifing the schema name in the SQL ?

This forum is for issues related to Oracle XML DB, not general questions. I suggest you try the General or SQL forum

Similar Messages

  • Question on schema name as prefix.

    The following program is running by schema called user1
    user1,user2 are schema names
    tab1 is table name
    col1 is coumn name
    DECLARE
         var1 user1.tab1.col1%TYPE;
         var2 user2.tab1.col1%TYPE;
    BEGIN
         NULL;
    END;
    Its been giving the followng exception :
    PLS-00905: object user1.user1 is invalid
    It means by default it appending user1.
    So,I took-off user1 from the above. It is working.
    But I dont want take off the user1. Any solution for this.
    Thx,

    There are no initialization parameters that would control this.
    Are you stating that you are unable to produce a test case that replicates your problem? That's what I'm interpreting your last two updates to mean. If that's the case, what you're seeing doesn't make sense and doesn't comport with what others see. If you can't produce a test case, though, it's probably unlikely that anyone will be able to guess what you've done wrong to be able to help you.
    Justin

  • How to get the current schema name

    Hi,
    Can anybody please tell me how to get the current schema name, there is some inbuilt function for this,but i am not getting that. Please help me.
    Thanks
    Jogesh

    ok folks, I found the answer at Tom's as usual.
    http://asktom.oracle.com/tkyte/who_called_me/index.html
    I rewrote it into a function for kicks. just pass the results of DBMS_UTILITY.FORMAT_CALL_STACK to this function and you will get back the owner of the code making the call as well some extra goodies like the name of the code and the type of code depending on the parameter. This ignores the AUTHID CURRENT_USER issues which muddles the schemaid. Quick question, does the average user always have access to DBMS_UTILITY.FORMAT_CALL_STACK or does this get locked down on some systems?
    cheers,
    paul
    create or replace
    FUNCTION SELF_EXAM (
       p_call_stack VARCHAR2,
       p_type VARCHAR2 DEFAULT 'SCHEMA'
    ) RETURN VARCHAR2
    AS
       str_stack   VARCHAR2(4000);
       int_n       PLS_INTEGER;
       str_line    VARCHAR2(255);
       found_stack BOOLEAN DEFAULT FALSE;
       int_cnt     PLS_INTEGER := 0;
       str_caller  VARCHAR2(30);
       str_name    VARCHAR2(30);
       str_owner   VARCHAR2(30);
       str_type    VARCHAR2(30);
    BEGIN
       str_stack := p_call_stack;
       -- Loop through each line of the call stack
       LOOP
         int_n := INSTR( str_stack, chr(10) );
         EXIT WHEN int_cnt = 3 OR int_n IS NULL OR int_n = 0;
         -- get the line
         str_line := SUBSTR( str_stack, 1, int_n - 1 );
         -- remove the line from the stack str
         str_stack := substr( str_stack, int_n + 1 );
         IF NOT found_stack
         THEN
            IF str_line like '%handle%number%name%'
            THEN
               found_stack := TRUE;
            END IF;
         ELSE
            int_cnt := int_cnt + 1;
             -- cnt = 1 is ME
             -- cnt = 2 is MY Caller
             -- cnt = 3 is Their Caller
             IF int_cnt = 1
             THEN
                str_line := SUBSTR( str_line, 22 );
                dbms_output.put_line('->' || str_line);
                IF str_line LIKE 'pr%'
                THEN
                   int_n := LENGTH('procedure ');
                ELSIF str_line LIKE 'fun%'
                THEN
                   int_n := LENGTH('function ');
                ELSIF str_line LIKE 'package body%'
                THEN
                   int_n := LENGTH('package body ');
                ELSIF str_line LIKE 'pack%'
                THEN
                   int_n := LENGTH('package ');
                ELSIF str_line LIKE 'anonymous%'
                THEN
                   int_n := LENGTH('anonymous block ');
                ELSE
                   int_n := null;
                END IF;
                IF int_n IS NOT NULL
                THEN
                   str_type := LTRIM(RTRIM(UPPER(SUBSTR( str_line, 1, int_n - 1 ))));
                 ELSE
                   str_type := 'TRIGGER';
                 END IF;
                 str_line  := SUBSTR( str_line, NVL(int_n,1) );
                 int_n     := INSTR( str_line, '.' );
                 str_owner := LTRIM(RTRIM(SUBSTR( str_line, 1, int_n - 1 )));
                 str_name  := LTRIM(RTRIM(SUBSTR( str_line, int_n + 1 )));
              END IF;
           END IF;
       END LOOP;
       IF UPPER(p_type) = 'NAME'
       THEN
          RETURN str_name;
       ELSIF UPPER(p_type) = 'SCHEMA.NAME'
       OR    UPPER(p_type) = 'OWNER.NAME'
       THEN
          RETURN str_owner || '.' || str_name;
       ELSIF UPPER(p_type) = 'TYPE'
       THEN
          RETURN str_type;
       ELSE
          RETURN str_owner;
       END IF;
    END SELF_EXAM;

  • What is table schema name?

    Hi,
    I was looking at DatabaseMetaData::getColumns() while searching for a way to get a table's column names and I run into these ugly params catalog and schemaPattern. Of course nowhere on the sun's site could I find a definition of these terms although they're used quite often in the API documentation. So I turned to a specific DBMS provider and found out that catalog is a fancy term for the system metadata. But what about the String schema param? I usually see a table's schema referred to as the "structure" of the table, what columns it contains of which types. But I've never known this "schema" can have a string name. Anyone so kind to explain it to me or better point me to a text that has definitions and explanations of the concepts used in the JDBC API documentation? And more generally for JDK where do you folks usually go when you want a simple explanation of how things work, not the dry listing of function and parameter names? Look at MSDN for example, it is both a good reference and a reasonable self-contained tutorial. Not that I praise Microsoft but...
    BTW I found that probably ResultSetMetaData is more suitable for my initial purposes, but still the questions bother me. So if you have any suggestion please let me know.
    Thank you in advance

    To answer your question, what is a table schema name?, it is the name of the schema that the table belongs to. If you have an Oracle database, MYDB, it will have at the very least two users which are SYS and SYSTEM, these are schema names, there are objects that exists in their schema. If you create a new user, JAKE, and then create a bunch of objects as JAKE, these objects are said to belong to the JAKE schema. All objects are like this, not just tables (indexes, sequence tables, triggers, etc.).

  • Need to know schema name and table name associated with a column-URGENT

    Hi folks,
    I need to know the schema name and the table name associated with a column. Though jdbc has the api to getTableName and getSchemaName, some database vendor like oracle does return empty upon call of mentioned methods. I found that oracle driver does not support that ……
    Can any one give me the solution? It is urgent. Or do you suggest any third pary jdbc driver which can provide those?
    Thanks
    Angelina

    Angelina,
    Your question has been discussed several times previously in this forum. Search this forum's archives for "getTableName". Oracle JDBC driver does not implement this (because "it is not feasible" -- according to Oracle).
    First of all, I would suggest that you could probably change your application's logic so that you would not need this functionality (but I guess that is not feasible either, right :-)
    Alternatively, you could try querying the Oracle database data dictionary.
    Good Luck,
    Avi.

  • DBACOCKPIT - wrong schema name

    Hi,
    We moved one of our satellite systems on another server. After that, the remote database monitoring in Solution Manager (7.0 EHP1 SPS26) doesn't work anymore. When I try to add the corresponding entry, the system refuses (database error 229 at EXE - Execute permission was denied on the object 'sap_tf_version') and I notice that the schema name is wrong (<domain>\SAPService<Solution Manager SID> instead of dbo). I can't replace the schema name because it is greyed out in the system information part.
    So my question: where the system gains its information about schema name from ?
    How to solve this problem ?
    Kind regards,
    Christophe

    Hello Christophe,
    Rerun the Database Monitoring setup at
    http://<solman_host>:<solman_port>/smd
        Navigate to Managed Systems -> Database Monitoring
    Best regards,
    Guilherme Balbinot

  • OWB 10.1 Deploy Mgr. - Registration - schema name is grayed out, sometimes

    Environment:
    Repository - OWB 10.1.0.2 on UNIX (AIX 5.2)
    Target - Oracle 9.2.0.4 on UNIX (AIX 5.2)
    Question: I have several locations that have been registered in the past. When I right click a location and click on 'Register' in some cases the schema name comes up grayed out and I am unable to change it and other times it is open.
    Why is that and how do I change the schema name of a location?
    I have installed the new schema as a target through the runtime assistant and there is a working runtime repository in that instance.
    Any help is greatly appreciated.
    P.S. Yes, we are making plans to upgrade to 10.2 soon but not soon enough ;-)>
    -gary

    Hi,
    In order to edit/delete a location you need to unregister the location from all the Control Centers. A location might be registered to more than one Control Centers.
    Having said that if you have registered location A to Schema B in Control Center C, you need to unregister the location A from Control Center C.
    In case you have accidentally dropped the Schema B without unregistering the location A, then even if you unregister the location A from Control Center C, you will still see the user name and password fields grayed out. In that case you need to re-create the schema B, register the location A and then again unregister the location and then you will be able to edit it. Seems to be a bug in OWB.
    Regards
    -AP

  • SQL Developer 4.0 - Database Diff - turn off schema name in generated script

    SQL Developer 4 / RDBMS 11GR2
    I know SQL Developer 4 is EA, but maybe the question has the same answer in 3.3.  Also if 4.0 EA questions need to be asked in a different forum, please advise.
    I am new to SQL Developer and I admit to using brand Z (TOAD) for many, many years.
    (1) When using Database Diff, is there a setting to turn off the schema name that is displayed in the scripts that are generated?  I looked in PREFERENCES, but if it is there, I did not see it.
    (2) While I have found good resources on SQL Developer, is there a FAQ on Database DIff that answers a lot of these silly type questions?
    Thanks in advance

    On the first screen of the DIFF wizard there's a check box for 'Schema' - uncheck that.

  • How to know database name and schema name by providing package name?

    Hi,
    Could someonw will help me to get database name and schema name by providing package name ?
    I have used the query : select * from all_objects where object_name='Package_name'; but it simply returns schema name where as i need DB name and username.
    --Prajakta

    but it simply returns schema name where as i need DB name and username.
    i want to retrive the DB name for package name
    Based on your questions, I wonder if you are used to working in SQL Server? (The server, database, and schema are part of the 4-part  name of an object, independent of any user.)
    In SQL Server, schema and username are two separate physical concepts.  "Schema" is purely logical in Oracle: a user which owns objects is often called a "schema".
    In Oracle, "database" is roughly equivalent to the SQL Server concept  "server" (what you log in to).  It is not part of the naming path to a specific object  (unless there is a database link involved, but there is no indication that's what you have here).  In Oracle you connect to an Instance (or Service) and people often call this the "database", but there is a fine semantic distinction there (separate topic). 
    Once connected in Oracle, you fully-qualify an object by only a 2-part owner and object name (possibly 3-part if a database link is involved user.object@link).
    12c added another wrinkle to all of this, but I'll assume this question was more basic than that, because you likely would have mentioned if this was a 12c question.

  • Is it possible keep reports independent of schema name using procedures

    Hi everyone,
    I have created reports using stored procedures.These stored procedures are inside a package in a particular schema.
    Now if the schema name differs at the client side,it is not possible to view reports.
    Is there any solution for the same.
    Regards,
    Misra P.

    Hello,
    Lots of samples available from the link above. Using .NET this can all be done, nothing exactly for what you want to do in a batch operation but you can usually build an array of report objects and then using the .Location or others and save the updated reports is in the sample on setting/updating database location/log on info.
    Post you SDK questions to SAP Crystal Reports, version for Visual Studio and search also, lots of sample code on how to.
    You'll also find a lot of sample here:
    Root Page
    http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsHome
    Enterprise Samples (including managed and unmanaged ras)
    http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsSDKSampleApplications
    Non-Enterprise Samples
    http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsSDKSampleApplications
    Exporting Samples (RAS)
    http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting
    I suggest you use RAS ( report application server ) to do this, more features available.
    Thank you
    Don

  • User & Schema name of Export dump file

    I have an exported dump file. I dont have any log file of that export. I want to Import it in another system. How do I know concerned user or schema name of that dump file.
    Is there any way to know it???

    dbanirav wrote:
    I have an exported dump file. I dont have any log file of that export. I want to Import it in another system. How do I know concerned user or schema name of that dump file.
    Is there any way to know it???made with exp or expdp?
    what OS name & version?
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Select schema name. How?

    Hi All,
    May be a very simple question, how can I select the schema name I'm logged into. I don't carry DBA privileges.
    --Sam                                                                                                                                                                                                                                                                       

    Thanks.
    --Sam                                                                                                                                                                                                                                               

  • DatabaseProcedure with return type prefixed with schema name

    Hi (Paco)
    I have a question about the DatabaseProcedure class. We are using Oracle proxy users for our database connections.
    Everything is accessed via a database role that are granted to the logged on user. All our database objects, tables etc are protected with this database role.
    When I want to call a database function/procedure I need to add the schema name as a prefix to the custom database object that we uses for parameters/return types.
    So far so good. I can also define a parameter prefixed with schema name via the DatabaseProcedure.registerArrayType ...
    But when I try to define a function call that uses this parameter I get an error saying "Declaration is not valid".
    The problem is located to the PROCEDURE_DEFINITION regular pattern:
    private static final Pattern PROCEDURE_DEFINITION = Pattern.compile("\\s* (FUNCTION|PROCEDURE) \\s+ ([\\w.$]+) \\s* (?:\\((.*?)\\))? \\s* (?:RETURN\\s+(\\w+))? \\s* ;? \\s*", CASE_INSENSITIVE | COMMENTS | DOTALL); The return type cannot be prefixed with the schema name.
    Any good suggestions or workarounds?!
    I actually did change the pattern runtime via reflection to make it work - but I really don't like this solution in the long run!
    /Torben
    Edited by: Zonic on 2013-05-07 10:52

    Hi Torben,
    I think I have a workaround for the issue that might work for you. If you look at the source of <font face="courier">DatabaseProcedure.registerArrayType</font> you find that it actually calls <font face="courier">DatabaseProcedure.registerCustomParamType</font>.
    public static void registerArrayType(String name)
      registerCustomParamType(name, Types.ARRAY, Array.getORADataFactory(), name);
    }As a workaround you could replace your calls to <font face="courier">DatabaseProcedure.registerArrayType</font> with calls to <font face="courier">DatabaseProcedure.registerCustomParamType</font> as follows.
    // Instead of DatabaseProcedure.registerArrayType("NAME.WITH.DOTS") call:
    DatabaseProcedure.registerCustomParamType("anyNameWithoutDots", Types.ARRAY, Array.getORADataFactory(), "NAME.WITH.DOTS"); // Don't forget to use uppercase here.
    DatabaseProcedure dp = DatabaseProcedure.define("procedure my.procedure(param1 in out anyNameWithoutDots)");
    DatabaseProcedure.ParamType type = dp.getParamDef(0).getType();
    System.out.println(type.getName() + " is " + type.getTypeName()); // ANYNAMEWITHOUTDOTS is NAME.WITH.DOTSThis way you don't have to use the "illegal" name in the DatabaseProcedure definition.
    Regards,
    Paco van der Linden

  • Schema name & user name

    Hi All,
    I have a question that can a username and schema name can be diffrent for a single user. For example when we connect with SYSOPER we connect with PUBLIC schema but the user is SYS.
    Is there any syntax to create the same.
    Thanks
    Bhupinder

    You can grant access for any user to "public", however, it's bad for security.
    Example-
    connect scott/tiger@mydb
    create table TomTable (main_id number);
    grant select on tomtable to public;
    connect newuser/newpass@mydb
    select * from scott.tomtable;
    This gives "newuser" access to Scott's "tomtable" table.
    You can also create public synonyms...
    As scott/tiger-
    create public synonym tomtable for scott.tomtable;
    connect newuse/newpass@mydb
    select * from tomtable;
    Now "newuser" doesn't need to include the schema name when they reference "tomtable".
    It's much safer to grant access to objects based on a role... otherwise, anyone with a login can get to "public" tables. One thing to be careful of when using roles; some things can't be done- as in, you can't create a view on a table, if you only have access to the table via a role. You'd need explicit access on the table.
    When you query all_tables, who is the real owner of the tables? Your username and schema name are one and the same, but you're allowed to have access into other schemas. SYS wins big-time because of the "select any table" system privilege. The only way a normal user can get to another schema's objects is by "grant select/update/insert/delete/etc on schema.object".
    -Thomas H

  • Schema name in front of trigger name.

    I have a doubt that all the triggers in my schema of the database of my application of about 200 users have the schema name before the trigger name. Say, if the trigger is 'Trig_1' & the schema is 'Schema_1', then the trigger name is like 'Schema_1.Trig_1'. But, today, i modified one trigger & created it without the schema extension like, say 'Trig_1' as per my eg. I hope, this does not create any problem.
    I hope, my question is clear. Please help in solving the doubt as it is urgent.
    Regards.

    Please help in solving the doubt as it is urgent.This is a simple enough problem to test. If it's that urgent you would be better off investigating it yourself rather than waiting for a passing guru to pontificate. But as I happen to be in the area... ;)
    Prefixing the object name with the schema name is a common enough practice in DDL scripts. When the schema name is omitted the object is created in the schema of the user running the command. If the schema name is included, the object is created in the schema specified. When this is the same as the user running the statement there is no difference. However, specifying the schema name does allow us to run installation scripts as power users i.e. those with privileges like CREATE ANY TABLE, CREATE ANY TRIGGER.
    Why would we want to do this? Well, if we want to roll out a change to every schema it's a lot easier to log on as the power user account and run one script which installs a trigger in two hundred schemas than it is to log on as two hundred different accounts and run two hundred scripts.
    Whether this reflects your situation is a question only you can answer. How is your application installed? If it's run from a single master script you need to include the schema owner in the DDL.
    I hope my answer is clear.
    Cheers, APC

Maybe you are looking for