Tables in a non-visible different scheme of service

I get a weird error in a function I wrote. I have user 'A', who has access to the patterns for users 'B' and 'C '. I need to update a table in the 'B' schema with schema database 'C '. So, I created a function that selects data from a table in the diagram "B", uses this information to find data of interest in the 'C' scheme and then I update the table in the diagram "B" with the information that I just look in the 'C' scheme Delete this day?

In any case, when I try to create the function (I'm using SQLPLUS to it), I get an error message that there is no such thing as the paintings that I am referencing the schema 'B' and 'C'. However, if I change the function so that I select a column that doesn't exist in a table in the diagram "B", then I get an error remind me. So it seems strange that I have enough visibility into patterns 'B' and 'C' if I am to access the data in the correct column names, but when column names are correct, I get an error message saying "table or view does not exist. I'm in my development environment, and the user 'A' is given the role of "DBA".

So, here's my function. Notice that I qualified table names with the owner of the schema (i.e. B.KPF_FOLDER_ITEMS) of advice would be greatly appreciated. Database is 9i

CREATE or REPLACE FUNCTION migrate RETURN number
IS

v_parent_item_id number (6);
V_ITEM_ID number (6);
v_line_Item_id number (6);

-variables to hold the data returned by the actual product tables
v_parent_item_number varchar2 (100);
v_color_code varchar2 (100);

CURSOR folderProducts IS
SELECT ITEM_ID as PRODUCT_PARENT_ITEM_ID, COLOR_ITEM_ID as ITEM_ITEM_ID, LINE_ITEM_ID as LINE_ITEM_ID
OF B.KPF_FOLDER_ITEMS
WHERE table_prefix = 'STRL ';

BEGIN

OPEN folderProducts.
LOOP
EXTRACT the folderProducts IN v_parent_item_id, v_item_id, v_line_item_id;
EXIT WHEN folderProducts % NOTFOUND;

-get the product number
SELECT BLA. PARENT_ITEM_NUMBERX IN v_parent_item_number
OF C.STRL_PRODUCTS BLA
WHERE BLAH. PARENT_ITEM_ID = v_parent_item_id;

-now get the color code
SELECT THE ITEM. COLOR_FINISH_CODE IN v_color_code
FROM THE POINT OF C.STRL_ITEMS
WHERE THE POINT. ITEM_ID = v_item_id;

-now, update the record in the kpf_folder_items table
UPDATE B.KPF_FOLDER_ITEMS
SET PRODUCT_NUMBER = v_parent_item_number,
COLOR_CODE = v_color_code
WHERE LINE_ITEM_ID = v_line_item_id;


END LOOP;

CLOSE FolderProducts;


END;

Published by: user10219585 on Sep 3, 2008 11:30 correctly identified the schema for one of the tables.

Published by: user10219585 on Sep 3, 2008 11:31

Objects stored with copyright (default for stored objects) ignore privileges based on roles. Ensure that the owner of MS is directly (not via the role) privileges on objects in the other schema.

SY.

Tags: Database

Similar Questions

  • The use of tables in an application of different schemas

    Hello!

    I create an application that uses all of the tables of a schema.

    Now, I need to import data to another schema.

    How do I do that?
    In the workspace, I added the schema.


    Kind regards

    Ivan

    You have to "bind" the 2nd pattern to your workspace so that this 2nd pattern appears in the drop-down lists.

    Do you it in the administration portal.

    Manage the workspace-> manage the workspace for pattern assignments.

    Oh... and make sure you have given the correct GRANT to the schema of your analysis.

    MK

  • foreign key referencing the table in different schema

    I create a foreign key for the table in the schema A a table to diagram B.

    I do that by grant references (column name) on the name of the table to username;


    is there any drawback/disadvantage in the creation of foreign keys referencing tables in another schema?

    Not as such, no.

    Generally, you want to check a second time when you are in this kind of situation that the two tables really belong in different schemas. It should be relatively rare to find a child table that belongs to a different schema than the parent. Sometimes, but it should be an exception, not the rule.

    Justin

  • Create the form on table in the different schema

    Hi all

    in APEX I am logged in as long as user APEX_USER and the table, I'm trying to access the site with the creation on Table Wizard form belongs to the user. I have granted all privileges on a given user APEX_USER table, the wizard allows me to choose this table in the list, but when I press the next button, I get the following error message:

    You do not have access to the schema that you import. Import failed.

    Contact your administrator for the application.

    Seems to me that something similar had been already discussed here, but still no response.

    V4.1 assistants when you use a different schema

    Please, what are the rights must have my APEX_USER to be able to create forms tables belonging to someone else?

    Thank you very much

    Pavel

    Edit: I did the same thing on my laptop (APEX 4.2.6.00.03) here and it works as expected. This error I get to work with APEX 4.2.3.00.08 (of course you should not necessarily be the cause, very likely, I don't have all of the necessary privileges) :-).

    Hi Mike,.

    Thanks again for your response. If the schema was not related to my workspace, I would yet be able to choose the other schema of the selection list.

    In fact, there seems to be a bug in the link in my message original (for example it is still not fixed in version 4.2.3), but fortunately I was able to find a workaround - I created a view with the same name and the same structure as the original table, and then I was able to generate the form with the wizard , finally I gave up the display and modification of processes page manually. So the solution is I have to force the DBA APEX upgraded to the current version :-).

    Best regards

    Pavel

  • How can I import tables to a different schema in the relational model existing... to add these tables in the existing model? PLSS help

    How can I import tables from a different schema in the relational model... to add these tables in the existing relational/logic model? PLSS help

    Notes; I already have a schema ready relational/logic model... and I need to add more tables to this relational/logic model

    can I import the same way like I did before?

    But even if I do the same how can I add it in the template? as the logic model has been designed...

    Help, please...

    Thank you

    To view the diagram of logic model in Bachman notation, you right-click on a blank area of the diagram and select the rating > Bachman Notation.

    David

  • Data Pump: export/import tables in different schemas

    Hi all

    I use Oracle 11.2 and I would like to use the data pump to export / import data into the tables between the different schemas. The table already exists in the source and target schemas. Here are the commands that I use:


    Script working export:

    expdp scott/tiger@db12 schema = source include = TABLE:------"IN (\'TB_TEST1 ', \'TB_ABC')\ 'directory = datapump_dir dumpfile = test.dump logfile = test_exp.log

    Script to import all the desks:

    Impdp scott/tiger@db12 remap_schemas = rΘpertoire source: target = datapump_dir dumpfile = test.dump logfile = test_imp.log content = data_only table_exists_action = truncate

    Script error for some tables to import:

    Impdp scott/tiger@db12 remap_schemas = source: target include = TABLE:------"IN (\'TB_TEST1')\' directory = datapump_dir dumpfile = test.dump logfile = test_imp.log content = data_only

    Export is good, I got the folling error when I try to import the table TB_TEST1 only: "ORA-31655: no metadata data_or objectsz selected for employment. The user scott is a DBA role, and it works fine when I try to import all tables being export without the include clause.

    It is possble to import some tables but not all tables in the export file?

    Thanks for the help!

    942572 wrote:

    It's good to import all tables exported through Scott, who do NOT have the clause 'include '.

    I have the error only when I try to import some tables with clause "include".

    Can I import only some table since the export dump file? Thank you!

    you use INCLUDE incorrectly!

    do below yourself

    Impdp help = yes

    INCLUDE

    Include the specific object types.

    For example, INCLUDE TABLE_DATA =.

  • How to collect statistics on the table for tables in a different schema

    Hi all

    I have a table in a schema, and I want to collect statistics for the table in a different schema.

    I gave GRANT ALL ON SCHEMA1. T1 TO SCHEMA2;

    And when I tried to run the command to collect statistics to help

    DBMS_STATS. GATHER_TABLE_STATS (OWNNAME = > 'SCHMEA1', TABNAME = > 'T1');

    The function will fail.

    Is there a way we can collect statistics of the table for tables in a schema into another schema.

    Thank you
    MK.

    You must grant analyze to schema2.

    SY.

  • Join of two tables in two different schemas

    Hi all

    I have an obligation to join two tables on two different schemas. How to join these two tables in the object view.

    Thanks in advance.

    Concerning
    Kaushik Guillaumin

    You can do just that using schema name in the +' view object.table name ' + according to the query object and also grant select the another schema to this schema user

    ex
    you need schem is test and another Act you need to a view object based on the test to join a table on shcema Act

    you write semply object sql view code:

    Act.table name

    and you can also give him select statement on Bill schem table to test

    concerning

  • Compare the table structures in different schemas. help please

    Hi all

    I have a question...


    I have pictures on different schemas something like


    Diagram A
    -------------
    Table 1
    Table 2
    Table 3


    Diagram B
    ------------
    Table 1
    Table 2
    Table 3


    Now situation is table 1 and table 2 will have a similar structure or table 1 in Figure B will have additional columns.

    like so... on... for all other tables...

    example!
    Schema A:
    
    Desc Table 1;
    
    Name                                  Type            Null
    -------------                             -------             -------
    No                                Number            Notnull
    Name                           Varchar2(10)     Not null
    Fee                              Number (10,2)   Not null
    
    
    
    Scheam B;
    
    Desc Table1;
    
    Name                                  Type               Null
    -------------                             -------             -------
    DX_No                                Number            Notnull
    DX_Name                           Varchar2(10)      Not null
    DX_Fee                              Number (10,2)   Not null
    comments                          Varchar(2)        
    Now I need to write some sort of procedure for the thing to compare these tables which are in different in the column names in the schema and get it had exported to an Excel sheet.
    and here it's first three columns SHOULD BE CONSIDERED AS SAME even if the DX_ prefix are from the REST OF the PART OF THE COLUMN NAME IS SAME.

    and the same way commit coloumn new schema B only... So it should be noted that excel sheets...

    I don't know how the ADO or SQL Developer handle this... Is there any plsql block that I can write to do it...

    Thanks in advance...

    Comparison of columns on all the tables in the two schema

    select tc1.owner,tc1.TABLE_NAME,tc1.COLUMN_NAME,
           tc2.owner,tc2.TABLE_NAME,tc2.COLUMN_NAME
    from
      all_tab_columns tc1
      full outer
      join all_tab_columns tc2 on &user1=tc2.owner
                               and tc1.TABLE_NAME=tc2.TABLE_NAME
                               and tc1.COLUMN_NAME like '%'||tc2.COLUMN_NAME
    where
    tc1.owner=&user2
    and tc1.TABLE_NAME in (
                          select t1.table_name
                          from all_tables t1
                          join all_tables t2 on t2.owner=&user2 and t1.table_name=t2.table_name
                          where t1.owner=&user1)
    

    Published by: xtender on 06.11.2010 12:43

  • Replication of tables in different schemas

    Hello

    I have 2 schemas and would like to have tables (same structure), in 2 different patterns, to be in harmony.

    For example:

    sample1.table_one

    sample2.table_one


    sample1.table_one DESC is exactly the same as sample2.table_one


    I want to both sample1.table_one and sample2.table_one to be in harmony, when changes are made to one of them.

    Oracle 9i does provide a mechanism for this or is the obvious solution only with PL/SQL and triggers.

    Discover the waterways

  • How to join two tables of different schemas of Oracle by using a subquery

    I'm trying to join two different schemas of Oracle tables using a subquery. I can extract data from each of the tables without problem. However, when I combine select statements it by using a subquery I get Oracle error *'ORA-00936: lack of expression ' *. Given that each SELECT statement runs on its own without error I don't understand what's missing. I'm trying to get the result set is matching the LINE_ID of PDTABLE_12_1 in the schema with the table PDTABLE_201 MAT_DESCRIPTION DD_12809 in the RA_12809 schema.

    The query is as follows:

    SQL = "SELECT [DD_12809]. [PDTABLE_12_1]. LINE_ID OF [DD_12809]. [PDTABLE_12_1] JOIN "_".
    + "(SELECT [RA_12809]. [PDTABLE_201]. MAT_DESCRIPTION "_".
    "FROM [RA_12809]. [PDTABLE_201]) AS FAB "_".
    + 'ON [DD_12809]. [PDTABLE_12_1]. PIPING_MATER_CLASS = FAB. PIPING_MATER_CLASS ".

    The format of the request is copied from a manual of programming SQL.

    I also tried running the query uses a right JOIN on the two tables, but got the same results. Any ideas would be useful. Thank you!

    Published by: user11338343 on October 19, 2009 06:55

    The format for the join of two tables in Oracle feels like any other database:

    SELECT a.col1, a.col2, ..., b.col1, b.col2, ...
    FROM   schema1.table1 a,
           JOIN schema2.table2 b ON a.col = b.col and ...
    WHERE  a.other_col = 'FRED'
    AND    ....;
    

    Do not place bracketed identifiers in Oracle. The account that connects to the database must have select privileges on the two tables.

  • Access a table in a different schema

    Hello geniuses.

    I have an APEX application built in the WVUAMS schema. I need to access the WVUMYA_USERS table that exists in the WVUMYA schema. How can I get APEX to allow this? Still running in the WVUAMS schema, my query is: SELECT * FROM WVUMYA. WVUMYA_USERS, but I get an error "table or view does not exist.

    I'm still fairly new to APEX and I have no access DBA or capabilities, then the chances are that I won't be able to do what you suggest on my own, but I'll try or ask someone else to do what you suggest the best I can.

    Thank you in advance!
    Jim

    HI jim,.

    WVUAMS - Application schema
    WVUMYA - owner of the object that you want to access from the schema WVUAMS

    When you run under request as a user WVUAMS
    in the workshop of SQL > SQL commands, you are able to get records of WVUMYA. WVUMYA_USERS?, if so same query should run on apex as well.

    SELECT * FROM WVUMYA.WVUMYA_USERS 
    

    If you get "table or view does not exist ', Flip to the user of WVUMYA and the question

    grant select on WVUMYA_USERS to WVUAMS
    

    Now go back to WVUAMS and run the query, you should be able to display the records of WVUMYA. WVUMYA_USERS

    Tell us just how much exactly you are doing in the apex in the apex, you are trying to run the same query or trying to select the table in the object list?

    To find out if you sqlplus(on windows) start > run > sqlplus

    Please take a look at this also http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_7001.htm

  • What are the ways to access a remote database in a database completely different-schema - stored procedure?

    My source data in the remote database schema (say C3.case). And I am trying to insert data of this CASE table in my database table (for example SIMS.case) I use the stored procedure to load the data.

    I was going through the documentation and I thought that the creation of MV is not possible in this case is the source table in the remote database schema. Is this correct?

    or create a link DB is the only option available to access the remote database schema table.

    Thank you.

    Hello

    2929538 wrote:

    My apologies for the bad conventions help. I meant remote schema.

    the required data and the destination table, the two are in oracle, but in totally different schemas.

    Yes, you said a table is in a scheme called C3, and the other is in a schema called SIMS.  Are these schemas in the same database or in different databases?

    If they are in the same database, then you do not have a database link.  Or the other schema can reference tables in the other qualifying names correctly, for example

    SELECT *.

    OF C3. case_studies

    ...

    assuming that the right privileges have been granted.

    If the schemas are in different databases, a database link is the best way to access data in a database in a different database.

    Without a database link, you will probably use some kind of use outside the database to write the data to a database, the file if necessary, transport and read in other databases.  DataPump files of images or CSV files, as Paulzip said in answer to #1, could be used for this.

  • Source code is the same name but different schema owner

    I got 1 of the online test and there the question has been asked. I have already answered but curious to cross-check my response with your advice...

    Question

    You want to see the source code of your defined package 'test1' and you issue the following query:

    Select the text in all_source

    WHERE name = "test1";

    After executing query, you have noticed that the result has 1 or more of source code with the code source test1 with the same name, but exist in different schema owner.

    Based on above circumstances, which is the type of possible object of the other source code?

    a Package

    b form

    c View

    d table

    e synonym

    My response was a (Package).

    Concerning

    Muzz

    Hello

    You answer is correct, all_source contains code for one of the following object types

    FUNCTION, JAVA SOURCE, PACKAGE, PACKAGE BODY, PROCEDURE, TRIGGER, TYPE,TYPE BODY

    for more detail check the following link

    http://docs.oracle.com/cloud/latest/db121/REFRN/refrn20249.htm#REFRN20249

    Concerning

    Salim

  • Sample package, cursor to different schema

    Hello

    Oracle 11.2.0.1
    Windows 7 Edition Home Premium 64-bit

    Can someone give me please an example below the installation program:

    User2 wants to create a package (pkg1 name) in which he wants to write:
    and username is set before running the package, assume he has "USER1".

    cursor c_emp select * of & username.emp; <-User2 is entitled to select on the table emp to the User1. TableName is fixed, but the same table name can be in different patterns, so before running the package, username assigned somewhere in the .sql file using ACCEPT varname GUEST.

    Example becomes more complicated when User3 would run the .sql file in which:

    The util_3 wants to open the cursor user2.pkg1.c_emp in its packaging.

    I will be grateful to you if you please give me a small example in action please.

    I reason my request please?

    Thanking you.

    user12050217 wrote:

    Currently, there are 20 drawings in my production database. Each schema is to have their own set of tables, functions, procedure etc.

    This is not bad. A schema can also be used a logical database.

    The issue is to have 20 copies of the same database logic - assuming that there is a problem on your side. Make a change to this logical database or PL/SQL code, becomes quite complex as there are has 20 copies to maintain and update.

    Invariably, these 20 copies will become out of sync that changes are made to some and not others. This becomes a nightmare very administrative complex.

    Oracle supports a feature called virtual private databases (VPDB). This allows to create a database of unique scheme/logic and use it for a number of different users. We use this feature for example in production, where a single logical database schema supports 500 corporate clients.

    VPDB requires Oracle Enterprise Edition. So if you do not use that, you will need to look at other options to support multiple clients/users in Oracle without having to duplicate the code and logical databases.

    Some time (in fact, its many time however) we need to produce a report that is based on a table that is named TRANBKUPS (Backup operation Table, who have different columns according to the drawing and the nature of the transaction, but some of them are the same as TRAN_ID (using the MASTER. (SEQUENCE), DRIVER_BONUS etc., but PASSENGER_NAME, TRAN_DATE, AGE, AMOUNT etc. are different). So, what I'm looking for, fires:
    Select TRAN_ID, TRAN_DATE, QUANTITY. TRANBKUPS... order in...

    There are a number of technical means for this. You can use dynamic SQL statements. You can use the interfaces of PL/SQL that returns a ref cursor Etc.

    However, the technical solution to use depends on the functional problem that must be solved. For example, what determines what patterns should be used and which not? Where is should the output of the cursor go? Are there performance problems that can be solved by running this process in parallel? For example if tranbackup of the 10 schema tables must be processed, the session can start 10 jobs and process these 10 tables at the same time.

    What is important but don't use NO SQL * for this conduct. IT a command line client Oracle. It is not like a programming tool for developing and managing the treatment conditional and exception management and so on.

    Develop using PL/SQL.

Maybe you are looking for