Tables in a different schema not visible from function

I'm getting a really weird error in a function that I wrote. I have user "A" who has access to schemas for users "B" and "C". I need to update a table in schema "B" with data from schema "C". So, I created a function that selects information from a table in schema "B", uses that information to find the data of interest in schema "C" and then I update the table in schema "B" with the information I just looked up in schema "C". Clear so far?
Anyway, when I try to create the function (I"m using SQLPLUS for all of this) I get an error message that the tables I am referencing in schema's "B" and "C" do not exist. However, if I modify the function so that I select a column that doesn't exists from a table in schema "B", then I get an error pointing this out to me. So, it seems weird that I have enough visibility into schemas "B" and "C" to know if I am accessing data by the correct column names, but when the column names are correct, I get an error message saying "table or view does not exist". I am in my development environment, and user "A" is granted the "DBA" role.
So, here is my function. Note that I have qualified the table names with the schema owner (i.e. B.KPF_FOLDER_ITEMS) Any tips 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 for holding data returned from 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
     FROM B.KPF_FOLDER_ITEMS
     WHERE table_prefix = 'STRL';
BEGIN
     OPEN folderProducts;
     LOOP
          FETCH folderProducts INTO v_parent_item_id, v_item_id, v_line_item_id;
          EXIT WHEN folderProducts%NOTFOUND;
          -- get the product number
          SELECT BLAH.PARENT_ITEM_NUMBERX INTO v_parent_item_number
          FROM C.STRL_PRODUCTS BLAH
          WHERE BLAH.PARENT_ITEM_ID = v_parent_item_id;
          -- now get the color code
          SELECT ITEM.COLOR_FINISH_CODE INTO v_color_code
          FROM C.STRL_ITEMS ITEM
          WHERE ITEM.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;
Edited by: user10219585 on Sep 3, 2008 11:30 AM correctly identified the schema for one of the tables.
Edited by: user10219585 on Sep 3, 2008 11:31 AM

Stored objects with DEFINER rights (default for stored objects) ignore role based privileges. Make sure SP owner is directly (not via role) granted privileges on objects in other schema.
SY.

Similar Messages

  • Moving Subpartitions to a duplicate table in a different schema.

    +NOTE: I asked this question on the PL/SQL and SQL forum, but have moved it here as I think it's more appropriate to this forum. I've placed a pointer to this post on the original post.+
    Hello Ladies and Gentlemen.
    We're currently involved in an exercise at my workplace where we are in the process of attempting to logically organise our data by global region. For information, our production database is currently at version 10.2.0.3 and will shortly be upgraded to 10.2.0.5.
    At the moment, all our data 'lives' in the same schema. We are in the process of producing a proof of concept to migrate this data to identically structured (and named) tables in separate database schemas; each schema to represent a global region.
    In our current schema, our data is range-partitioned on date, and then list-partitioned on a column named OFFICE. I want to move the OFFICE subpartitions from one schema into an identically named and structured table in a new schema. The tablespace will remain the same for both identically-named tables across both schemas.
    Do any of you have an opinion on the best way to do this? Ideally in the new schema, I'd like to create each new table as an empty table with the appropriate range and list partitions defined. I have been doing some testing in our development environment with the EXCHANGE PARTITION statement, but this requires the destination table to be non-partitioned.
    I just wondered if, for partition migration across schemas with the table name and tablespace remaining constant, there is an official "best practice" method of accomplishing such a subpartition move neatly, quickly and elegantly?
    Any helpful replies welcome.
    Cheers.
    James

    You CAN exchange a subpartition into another table using a "temporary" (staging) table as an intermediary.
    See :
    SQL> drop table part_subpart purge;
    Table dropped.
    SQL> drop table NEW_part_subpart purge;
    Table dropped.
    SQL> drop table STG_part_subpart purge;
    Table dropped.
    SQL>
    SQL> create table part_subpart(col_1  number not null, col_2 varchar2(30))
      2  partition by range (col_1) subpartition by list (col_2)
      3  (
      4  partition p_1 values less than (10) (subpartition p_1_s_1 values ('A'), subpartition p_1_s_2 values ('B'), subpartition p_1_s_3 values ('C'))
      5  ,
      6  partition p_2 values less than (20) (subpartition p_2_s_1 values ('A'), subpartition p_2_s_2 values ('B'), subpartition p_2_s_3 values ('C'))
      7  )
      8  /
    Table created.
    SQL>
    SQL> create index part_subpart_ndx on part_subpart(col_1) local;
    Index created.
    SQL>
    SQL>
    SQL> insert into part_subpart values (1,'A');
    1 row created.
    SQL> insert into part_subpart values (2,'A');
    1 row created.
    SQL> insert into part_subpart values (2,'B');
    1 row created.
    SQL> insert into part_subpart values (2,'B');
    1 row created.
    SQL> insert into part_subpart values (2,'C');
    1 row created.
    SQL> insert into part_subpart values (11,'A');
    1 row created.
    SQL> insert into part_subpart values (11,'C');
    1 row created.
    SQL>
    SQL> commit;
    Commit complete.
    SQL>
    SQL> create table NEW_part_subpart(col_1  number not null, col_2 varchar2(30))
      2  partition by range (col_1) subpartition by list (col_2)
      3  (
      4  partition n_p_1 values less than (10) (subpartition n_p_1_s_1 values ('A'), subpartition n_p_1_s_2 values ('B'), subpartition n_p_1_s_3 values ('C'))
      5  ,
      6  partition n_p_2 values less than (20) (subpartition n_p_2_s_1 values ('A'), subpartition n_p_2_s_2 values ('B'), subpartition n_p_2_s_3 values ('C'))
      7  )
      8  /
    Table created.
    SQL>
    SQL> create table STG_part_subpart(col_1  number not null, col_2 varchar2(30))
      2  /
    Table created.
    SQL>
    SQL> -- ensure that the Staging table is empty
    SQL> truncate table STG_part_subpart;
    Table truncated.
    SQL> -- exchanging a subpart out of part_subpart
    SQL> alter table part_subpart exchange subpartition
      2  p_2_s_1 with table STG_part_subpart;
    Table altered.
    SQL> -- exchanging the subpart into NEW_part_subpart
    SQL> alter table NEW_part_subpart exchange subpartition
      2  n_p_2_s_1 with table STG_part_subpart;
    Table altered.
    SQL>
    SQL>
    SQL> select * from NEW_part_subpart subpartition (n_p_2_s_1);
         COL_1 COL_2
            11 A
    SQL>
    SQL> select * from part_subpart subpartition (p_2_s_1);
    no rows selected
    SQL>I have exchanged subpartition p_2_s_1 out of the table part_subpart into the table NEW_part_subpart -- even with a different name for the subpartition (n_p_2_s_1) if so desired.
    NOTE : Since your source and target tables are in different schemas, you will have to move (or copy) the staging table STG_part_subpart from the first schema to the second schema after the first "exchange subpartition" is done. You will have to do this for every subpartition to be exchanged.
    Hemant K Chitale
    Edited by: Hemant K Chitale on Apr 4, 2011 10:19 AM
    Added clarification for cross-schema exchange.

  • Need to build a form based on a table in a different schema

    Hello all,
    I am still new to APEX. I have been playing with it for a few days.
    I have an APEX user 'demo' whose default schema is demo1.
    But I need to create a form that can insert,update and delete based on table 'employee' in schema demo2.
    Demo has all the rights on employee table in demo2. I also assigned the demo2 schema to demo user's workspace.
    But when I am building the form, demo1 is th eparsing schema, but in table/view owner only demo1 is available. I don't see demo2 even though I assigned it to demo user's workspace.
    Is it possible to build a form based on a table in a different schema? I tried creating a synonym, but it doesn't show up in the list of tables to select from.
    I don't want to create views or anything because there are many tables in different schemas and it's not possible to go on creating views or such for each one.
    I was able to access th etable in a report though by prefixing the table name with the schema name.
    I would appreciate if someone could point me in the right direction.
    Thanks!

    Varad,
    Thank you for the explanation. So from what I understand, every time I create a form or report based on a table in a different schema, just change the parsing schema in application definition to the new one and create the form or report. So this way my forms and reports or whatever can be based on different tables in different schemas and they would run fine when deployed in a runtime environment (provided the appropriate privileges are there on the objects in context)?
    I tried this and I was able to see the different schema and select the table and create the form. I haven't tested in runtime though.
    Seems like a feasible option, need to test all scenarios though. If this is a feasible solution then there is no need to create synonyms or views (I am not talking about others' scenarios such as security etc) etc. Just appropriate privileges will do it.
    Thanks Varad. Have you used this way of creating a form in your apps? I need to explore more to see if it breaks anything.
    So, every time I need to select an object, say a table, in a different schema I need to temporarily change the parsing schema to that schema in the application definition? Is that a correct statement?
    I will leave the thread open to see if anybody has any comments.

  • Need query to compare the columns of 2 diff tables of 2 different schemas.

    There are two different tables(sample1, sample2) in different schemas(s_schema1, s_schema2).
    I want the query to compare the columns of two different tables of two different schemas and provide whether the data as well as the count of data in
    the column are same .
    if not provide the data which is not similar in the columns of two different table.
    NOTE:
    I need queries for both the cases.
    (i) The datatypes in columns of two different tables are same.
    (ii) The datatypes in columns of two different tables are diffrent.

    Welcome to the forum!
    Whenever you post provide your 4 digit Oracle version.
    >
    I need queries for both the cases.
    >
    Great - write the queries!
    The forum is not a coding service where you ask people to write code for you for free.
    YOU need to write the code. Then if you have a problem with the code you have written post the code you have written (using \ tags) and explain the problem you are having.
    Read the FAQ about how to ask a question on the forums.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Joining two tables in two different schema

    Hi All,
    I have a requirement to join two tables in two different schema. How to join these two tables in view object.
    Many thanks in advance.
    Regards
    Kaushik Gopalakrishnan

    1) If these tables are in one and same database instance, then you can join them by specifying the fully-qualified table names (inlcuding the schema name), for example:
    SELECT ...
    FROM schema_A.table1 T1, schema_B.table2 T2
    WHERE T2.parent_code = T1.code
         AND ...2) If the tables are in different database instances, then you can create a database link in one of the databases and access the table from the other database via the DB link, for example:
    SELECT ...
    FROM schema_A.table1 T1, schema_B.table2@mydblink T2
    WHERE T2.parent_code = T1.code
         AND ...3) If the tables are in different database instances and there is no option for DB links, then you cannot join the tables in an ADF ViewObject.
    Dimitar

  • How to gather table stats for tables in a different schema

    Hi All,
    I have a table present in one schema and I want to gather stats for the table in a different schema.
    I gave GRANT ALL ON SCHEMA1.T1 TO SCHEMA2;
    And when I tried to execute the command to gather stats using
    DBMS_STATS.GATHER_TABLE_STATS (OWNNAME=>'SCHMEA1',TABNAME=>'T1');
    The function is failing.
    Is there any way we can gather table stats for tables in one schema in an another schema.
    Thanks,
    MK.

    You need to grant analyze any to schema2.
    SY.

  • Actual and Forecast not visible from Planning App -- VERY CRITICAL ISSUE ,

    this is a very critical issue.. need immediate help..
    my customer cannot see the Actual and Forecast not visible from Planning App. please help me with the same. tell me the possible solns as i cudnt have a web confrerence with the custmer till now.
    thanks/

    John ,
    they are seeing the application in planning. they created a scenario dimension containing , budget, actual and forecast.. but in the planing application they can only see budget. the rest 2 are not visible.
    thanks..

  • Data Table module enabled script is not visible in Oracle Test Manager

    Hi,
    Data Table module enabled script is not visible in Oracle Test Manager (OTM)
    Steps to reproduce:
    1.     Create new script (Oracle EBS/Forms)
    2.     Enable Data Table module (Script--->Script Properties-->Modules) and save.
    3.     Try to add the script in Oracle Test Manager.
    Environment details:
    Windows 7
    OATS Version: 12.1.0.2 Build 58
    IE 9
    Thanks
    -Pops

    Hi Deepu,
    I'm trying to add Data Table enabled script in Oracle Test Manager.
    Data Table Module enable script is not visible in OTM.
    In OATS 12.3, also i'm facing the same issue.
    Thanks,
    POPS

  • Mail send from iPhone not visible from Macbook

    Any mail I sent from my iPhone (latest OS) is not visible from my Macbook Pro (latest OS) in the sent box. 
    I need this to be fixed. How? I have read through the forums and there seems to be no fix to this. And yes, I have everything configured properly (ie. to keep sent messages on server, etc).
    Any help to fix this would be appreciated as I need to access all my emails for work from my computer.

    Please ignore the above .  I have discovered what I did wrong - but don't know how to delete the question!
    Sorry

  • HTML DB application using table in a different schema

    I need to create a new HTML DB application. The table is in a different schema than mine. The DBA granted me rights to see it and I can see it from iSQL. HTML DB does not give the alternative of selecting this table.

    This thread covers your issue.
    New to HTML DB, have questions about service admin and schemas
    Ask your DBA to add workspace to schema mapping.
    Sergio

  • Compare table structures in different schemas. help please

    Hi all,
    I have a question...
    I have tables on different schemas some thing like
    Schema A
    Table 1
    Table 2
    Table 3
    Schema B
    Table 1
    Table 2
    Table 3
    Now situation is Table 1 and Table 2 will have similar structure or Table 1 in Schema 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 a procedure sort of thing to compare these tables which are in different in column names in both schema and get it exported to Excel sheet.
    and here thing is first three columns SHOULD BE TREATED AS SAME even though prefix of DX_ exist since REST OF THE PART OF COLUMN NAME IS SAME.
    and in same way commets is new coloumn in schema B only..So that should be highlighted excel sheets..
    I am not sure how OAD or SQL Developer handle this...Is there any plsql block I can write to do above..
    Thanks in advance..

    An example of one method (this is just a starting point, you'll have to build it out to suit your needs).
    create table emp as select * from scott.emp where 1=0;
    alter table emp add (junk number(1));
    select
          t1.column_name as t1_column_name
       ,  t2.column_name as t2_column_name
    from
       select column_name
       from
          dba_tab_columns
       where
          table_name  = 'EMP'
       and
          owner       = user
    ) t1
    full outer join
       select column_name
       from
          dba_tab_columns
       where
          table_name  = 'EMP'
       and
          owner       = 'SCOTT'
    ) t2
    on (t1.column_name = t2.column_name)
    where
       t1.column_name is null
    or
       t2.column_name is null;
    T1_COLUMN_NAME                 T2_COLUMN_NAME
    JUNK
    1 row selected.
    TUBBY_TUBBZ?If you need to remove prefix's ... you would just do that in the select list (using regexp_replace, translate, substr, whatever you think is appropriate for your situation).
    Edited by: Tubby on Nov 6, 2010 12:38 PM
    Forgot to mention that this code will report differences between two schemas, regardless of where the additional columns reside ... if you have a 'master' schema that is the definitive source, then you would want to use the query provided by Xtender.

  • Acess table located on different schema

    hi ,
    oracle 10.2.0.1.0
    I have production database and i'm able to access video_asset_language located on different schema (CAM) of same db.there is synonym for the table here (at production ) .If I query user_synonyms the last column DBLINK has entry here.
    Now from development DB I created a synonym for the table video_language_asset located in CAM schema. it says "translation error " . Synonym is created but not able to fetch from the table. If I query user_synonyms the last column DBLINK has no entry here.
    Please suggest what I need to do .
    thanks
    Kishna

    - Verify you have been granted select access to the table (from user_tab_privs_recd)
    - Verify the database link exists, if not create it (get the definition using dbms_metadata.get_ddl
    - get the correct synonym definition, and replace the synonym when (get the definition using dbms_metadata.get_ddl)
    Sybrand Bakker
    Senior Oracle DBA

  • Data is visible in base tables of BOM routing but not visible in front end

    Hi,
    Through BOM_RTG_PUB API I am populating routing data into base tables, it is successfull.. but that data is not visible in front end when i queried from front end..
    i am getting error while i run API as......
    An error occured while processing business object BOM_ITEM12 in organization MMO. Please check the data in this business object and re-run the import process.
    Can any one help me in finding out what's wrong with this..
    Thanks in advance..
    Edited by: 875417 on Feb 6, 2012 10:49 PM

    Your obeservation is correct, and expected behavior.
    This behavior is useful when you have inputs that you would like to set as defaults for the user.
    Obviously, if there is a value to be saved, it will require some memory to store the value.
    If the input is left empty by default, that memory is made available again.
    It may not be easy to think of a good use for this for a graph, but think about for numeric or string controls.
    What if the user isnt sure how they should input a certain parameter or value?
    You could store a default value so they could see how they should input their value.
    Message Edited by Cory K on 09-15-2009 11:12 AM
    Cory K

  • Profile description is not visible from Application which the LDT file has.

    Experts,
    I am running into strange issue.
    Dev created a LDT file for a profile and requested to upload it through a one-off patch.
    The profile got updated into the DB for all the 3 languages - US, KO and AR.
    However the description is not visible for US when tried to verify from the Forms.
    Further analysis gave a tip that the description is NULL only for US and exists for other 2 Langs (KO and AR).
    SQL> select PROFILE_OPTION_NAME, DESCRIPTION, LANGUAGE, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATED_BY, CREATION_DATE
    2 from fnd_profile_options_tl where
    3 profile_option_name='INL_ITEM_CATEGORY_SET';
    PROFILE_OPTION_NAME DESCRIPTION LA LAST_UPDAT LAST_UPDATED_BY CREATED_BY CREATION_D
    INL_ITEM_CATEGORY_SET {Category Set to determine the items that will be  AR 09-NOV-12              122        122 11-JUL-11
                              LCM trackedسÙÙ
                                             اÙ
    ٠سÙÙ
          اÙ
    ٠سÙÙ
          اÙ
    ٠سÙ}
    INL_ITEM_CATEGORY_SET {Category Set to determine the items that will be  KO 09-NOV-12              122        122 11-JUL-11
                              LCM trackedâ
                                          ¦'+++ '+++ '+++ '+++ '+++ '+++ '+++ '++
                              +Ã
    INL_ITEM_CATEGORY_SET                                                                            US 12-MAR-12             *2330*        122 11-JUL-11
    SQL>
    Also identified the Last Updated By is from FND User - "PROCESS_OPS"
    SQL> select USER_ID, USER_NAME from fnd_user where USER_ID in (122, 2330);
       USER_ID            USER_NAME
           122               ORACLE12.2.0
          2330              PROCESS_OPS
    SQL>
    What could be the reason behind this change?
    Why the profile description only for US Lang is not getting updated whereas for other languages it got updated by FND User - "ORACLE12.2.0"?
    It clearly shows on 09-Nov-12 there were some changes happened and that to by User_ID 122 which updated for KO and AR.
    For some reason the same was not applied for US Lang.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    HI Hussein,
    I am waiting for your update only.
    We have requested Dev to chek the same got to know that,Yes, when tried with CUSTOM_MODE=FORCE, it is working fine.
    But they are insisting on how the other Langs got updated and why it would not update for US alone.
    Just check the Profile from FND_PROFILE_OPTIONS about the profile details and found below.
    SQL> select APPLICATION_ID, PROFILE_OPTION_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY
    2 from fnd_profile_options where PROFILE_OPTION_NAME='INL_ITEM_CATEGORY_SET';
    APPLICATION_ID PROFILE_OPTION_ID LAST_UPDATE_DATE LAST_UPDATED_BY
    CREATION_DATE CREATED_BY
    9004 1011555 12-MAR-12 2330
    11-JUL-11 122
    SQL>
    For some reason the TL got lastupdate_date and 09-NOV-12 and the same is not reflecting in FND_PROFILE_OPTIONS.
    Please advise.

  • Move table to a different schema

    How can i move a particular table from one schema to another.
    I have no mutual depenencies on anyother tables.

    Couldn't you just use CREATE TABLE <tablename> AS SELECT * FROM oldschema.<tablename> in the new schema, then drop the table in the old schema? Or, is your situation more complex than that? You might need to create a synonym to point to the new table from the old schema...
    For this to work, you'll need to make sure that the new schema has select privileges on the old schema's table. If it doesn't, while logged into the old schema, use:
    GRANT SELECT on <tablename> to <newschema>;Then, if you still need to access the table from the old schema once it's moved, you'll need to grant those privileges from the new schema:
    GRANT SELECT on <tablename> to <oldschema>;(Though, using roles is a better option than granting privileges directly to a schema...)
    Edited by: user11033437 on Aug 24, 2010 8:47 AM

Maybe you are looking for

  • Forgot to create Goodwill asset during asset migration

    Hi In the migration process ,w eforgot to create a goodwill as an asset in asset accounting,but we migrated the balances into the respective GL accounts now we need to create this asset because for local balances we have to post the depreciation plea

  • Read txt files in DoJa?

    I don't know if this is the right place to post this, but I haven't found any DoJa topic neither have I found good DoJa forums. So I thought I post it here. My problem is: I'm trying to read and write .txt files in DoJa. I've wrote this script in JCr

  • I click on something in safari and it opens up an ad in new tab

    I have 8.0.5 version of safari and ever since i accidentally went on a dodgy website it has been opening up ads in new tabs whenever i click on something in the browser. Can't get anything done and I have tried everything that i have searched online.

  • Translating Chinese characters to Roman Characters

    Is anyone aware of software that will translate Chinese characters to Roman characters?

  • Automatically database creation

    Can toplink similarly to creating tables when toplink.ddl-generation=create-tables also create database? Maybe there is a special property for such behavior.