Error using views from other schema

Hello,
i recently had problems using the execute immediate statement in Object Types.
The SQL statement tried to select from some views which were owned by an other schema.
Although we had public synonyms on these views and the same dynamic sql could be used out of a stored procedure the usage in the object type raised a "table or view does not exist exception".
using the same views in the same schema where the object types belonged to, was ok.
example:
schema: scott
view: my_view
schema: dave
sql: "select from scott.my.view ....."
works well from a stored procedure, but nor if used in an object type
create the view in schema "dave" an then
sql: "select from my.view ....."
works fine.
So is someone aware of this behaviour?
Is this a bug or a feature?
regards
peter

Hello Geoff,
here is the sample code.
If the table my_table belongs to the same
schema runningthe code the code runs with
no exception.
But if the table belongs to an other schema
(lets say SCOTT),
only having global synonyms and the rigths to
select on it, the code will raise an exception "table or view does not exist"
even if we use SCOTT.my_table in the
select.
create type query_o as object(
dummy integer,
static function get_query return
varchar2;
create or replace type body query_o as
static function get_query return varchar2
as
query varchar2(4000) :=
'select ' | |
' f.amount_month ' | |
'into :r1 ' | |
'from ' | |
' my_table f ' | |
'where id=:p1 ';
begin
return query;
end;
end;
create type consumer_o as object(
amount_month number,
member function find(p_id in integer)
return consumer_o
create type body consumer_o as
member function find(p_id in integer)
return consumer_o
as
l_amount number;
begin
execute immediate query_o.get_query()
using out l_amount,
in p_id;
return consumer_o( l_amount );
end;
end;
kind regards
peetr

Similar Messages

  • Can't see DDL of views from other schemas in Developer?

    Hi,
    I've seen elements of this problem in other threads but this problem of course has it's own twist.
    I can see other schema's objects EXCEPT VIEW DDL.
    I have given a user every role and priv that I can and they still can't see the view ddl of another schema. They can see procedures, functions etc. just not the view. I've found that if I use the user that created the users I can see the DDL of all subordinate users. Users created under that schema can not see each others views no matter what rights are given. Interestingly enough sometimes when I look to display view DDL it will flash the DDL briefly before blanking the screen. very frustrating. All the Toad fanboys are crowing about how they couldn't possibly use a tool that doesn't allow them to see other view source.
    I have also looked for settings in the preferences but could find none.
    Is this a bug? It seems like one to me.
    Any help is greatly appreciated.
    Thanks
    Mark

    We have a bug logged for this.
    Sue

  • Import from other schemas other than default

    Hi,
    I defined a source metadata location to an Oracle database. The user used to connect to the DB itself has no objects. I need to import tables and views from other schemas in the source Oracle database. It that possible using the same user that was used in creating the metadata source location? Or, does one need specific one-to-one connection established as separate source metadata locations in order to import tables and views from other schemas?
    In other words, is one user/password to a database sufficient to import tables and views from other schemas?
    Thanks!

    I'm not sure you can import directly into the Android version of Firefox due to security limitation on the device. If you can get your Opera bookmarks into Firefox on the desktop, you can use Firefox Sync to move them to your mobile.
    Does this thread help? [https://support.mozilla.org/en-US/questions/923976 how can I sync bookmarks between my opera mobile browser and my new Firefox for android browser ? | Firefox Support Forum | Firefox Help]

  • ORA-12008:ERR OCCCURS WHEN MATERIALIZED VIEW IS REFRESHED FROM OTHER SCHEMA

    Hi,
    ORA-12008: Error occcurs when materialized view is refreshed from another schema, Following the output of the trace file when error occured.
    /u01/app/oracle/admin/orcl92/bdump/orcl92_j000_23729.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
    System name: Linux
    Node name: newdbserver
    Release: 2.6.9-5.ELsmp
    Version: #1 SMP Wed Jan 5 19:30:39 EST 2005
    Machine: i686
    Instance name: orcl92
    Redo thread mounted by this instance: 1
    Oracle process number: 164
    Unix process pid: 23729, image: oracle@newdbserver (J000)
    *** SERVICE NAME:(SYS$USERS) 2008-05-23 10:30:51.848
    *** SESSION ID:(462.21166) 2008-05-23 10:30:51.848
    *** 2008-05-23 10:30:51.848
    ORA-12012: error on auto execute of job 766
    ORA-12008: error in materialized view refresh path
    ORA-00942: table or view does not exist
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
    ORA-06512: at "SYS.DBMS_IREFRESH", line 683
    ORA-06512: at "SYS.DBMS_REFRESH", line 195
    ORA-06512: at line 1
    Regards,
    Abhishek

    Hi Damorgan,
    As i said, when refresh materialized view from another schema, mentioned error occurs.
    I have also granted accees explicitely still following error occurs.
    ORA-12008: error in materialized view refresh path
    ORA-00942: table or view does not exist
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2255
    ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2461
    ORA-06512: at "SYS.DBMS_IREFRESH", line 683
    ORA-06512: at "SYS.DBMS_REFRESH", line 195
    ORA-06512: at line 1
    Regards,
    Abhishek
    Message was edited by:
    AbhishekRathod(user559364)

  • Is there a way to access object from other schema?

    1. Is there a way to access object from other schema
    Without using synonym/public synonym without prefixing schema owner?
    2. If you do not see any object in all_objects by same name owned by connected user or public, can there still be objects hidden from this view? for instance synonyms created by SYSTEM
    TIA for help

    Well, you missed something somewhere. If there is no
    ALTER SESSION SET CURRENT_SCHEMA=whoeverthen there must be either public synonym for the object as this shows:
    SQL> CREATE USER a identified by a;
    User created.
    SQL> GRANT CREATE SESSION to a;
    Grant succeeded.
    SQL> CREATE USER b identified by b;
    User created.
    SQL> GRANT CREATE SESSION, CREATE PROCEDURE, CREATE PUBLIC SYNONYM to b;
    Grant succeeded.
    SQL> connect b/b
    Connected.
    SQL> CREATE PACKAGE test AS
      2     PROCEDURE testit;
      3  END;
      4  /
    Package created.
    SQL> CREATE PACKAGE BODY test AS
      2  PROCEDURE testit IS
      3  BEGIN
      4     NULL;
      5  END;
      6  END;
      7  /
    Package body created.
    SQL> connect a/a
    Connected.
    SQL> desc b.test
    ERROR:
    ORA-04043: object b.test does not exist
    SQL> connect b/b
    Connected.
    SQL> GRANT EXECUTE ON test TO a;
    Grant succeeded.
    SQL> connect a/a
    Connected.
    SQL> desc b.test;
    PROCEDURE TESTIT
    SQL> desc test;
    ERROR:
    ORA-04043: object test does not exist
    SQL> connect b/b
    Connected.
    SQL> CREATE PUBLIC SYNONYM test FOR TEST;
    Synonym created.
    SQL> connect a/a
    Connected.
    SQL> desc test
    PROCEDURE TESTITAnother possibility without public synonyms is that crv had granted the other user privileges on some object, and the other user creates a private synonym for that. When crv granted privileges on a different object with the same name, the private synonym became valid again. Something like:
    SQL> connect /
    Connected.
    SQL> drop public synonym test;
    Synonym dropped.
    SQL> GRANT CREATE SYNONYM TO a;
    Grant succeeded.
    SQL> connect a/a
    Connected.
    SQL> desc test;
    ERROR:
    ORA-04043: object test does not exist
    SQL> desc b.test
    PROCEDURE TESTIT
    SQL> CREATE SYNONYM test FOR b.test;
    Synonym created.
    SQL> desc test;
    PROCEDURE TESTIT
    SQL> connect b/b
    Connected.
    SQL> REVOKE EXECUTE ON test FROM a;
    Revoke succeeded.
    SQL> connect a/a
    Connected.
    SQL> desc test;
    ERROR:
    ORA-04043: object "B"."TEST" does not exist
    SQL> desc b.test
    ERROR:
    ORA-04043: object b.test does not exist
    SQL> connect b/b
    Connected.
    SQL> DROP PACKAGE test;
    Package dropped.
    SQL> CREATE FUNCTION test (p_num IN NUMBER) RETURN NUMBER AS
      2  BEGIN
      3     RETURN p_num * 10;
      4  END;
      5  /
    Function created.
    SQL> GRANT EXECUTE ON test TO a;
    Grant succeeded.
    SQL> connect a/a
    Connected.
    SQL> desc test;
    FUNCTION test RETURNS NUMBER
    Argument Name                  Type                    In/Out Default?
    P_NUM                          NUMBER                  INSo, I would go looking for the synonyms.
    TTFN
    John

  • Error while Driving a view using parameters from other view

    Hi,
    I have created a report with streamlist and Barchart view.Driving option is used in streamlist to drive the barchart. The driving works well untill i dont use any filters in the Streamlist.Once i use parameters in streamlist , the driving works only for the default values set.When Second set of values are chosed for the parameter,the values are displayed correctly , but once they are selected for driving,the current values are replaced by the results of the default parameter settings.
    I have already done the tutorials for driving and it worked well untill i use filters in the main view,from where the driving is done.
    I would really appreciate if someone could give a solution for this problem.
    Regards,
    Lathika

    Hi,
    Login as i.e. sys as sysdba. Standard password is change_on_install.
    Or you can login in using user that has CREATE VIEW WITH ADMIN OPTION and then grant CREATE VIEW privilege to user to want.
    Peter D.

  • Exporting views from a schema

    Hi Gurus,
    We have a problem while creating a replica of a remote DB in local.
    We were able to export all DB objects except views.
    As they are critical for making the local DB 'complete', we are looking for a solution.
    We have tried the below query for getting the definition for a single view on a schema, but the query is taking too much time, even if run on the server.
    Select dbms_metadata.get_ddl('VIEW','<VIEW NAME>') from dual
    Please suggeest us a solution for the same.
    NOTE: Unfortunately we don't have any advanced tools and we are just relying on the Oracle SQL developer, even for developement.
    Thanks & Regards
    RK Veluvali

    What error are you getting when you run datapump expdp? If all you want it views you could run
    expdp user/password include=views schema=schema_list ...
    Please post the version you are using and the errors.
    Thanks
    Dean

  • Throwing error using view objects in Table

    Hi,
    I am making use of 2 different view objects to assign column values for table region.
    it is throwing me error that particular attribute is not defined.
    cann't we use two different view objects in table?
    - Mithun

    No, this is not possible. Table component is used for tabular representation of data derived from the contents of a single view instance. Also, you cannot have two tables in the same page with the same view instance unless this is read-only view.

  • Renaming View from another schema

    Hi,
    I've 2 schemas  namely  department  ,  hr
    Now department schema is having one table EMP . And a view is created on that table with the name R_EMP
    Schema Name :  department
    Table Name  :  EMP
    View Name   :  R_EMP
    GRANT SELECT ON R_EMP  TO  HR ; 
    In HR schema a synonym has been created on view R_EMP with the name R_EMP .
    CREATE OR REPLACE SYNONYM hr.R_EMP for department.R_EMP
    Schema Name :  hr
    Synonym Name:  R_EMP
    Now I want to rename the view name R_EMP  to V_EMP  from  HR schema only
    So, I tried the folloiwng syntax in HR schema (All the operations should be done from this schema only )
    [code]
    RENAME department.R_EMP to department.V_EMP ;
    Error:
    ORA-01765: specifying table's owner name is not allowed
    [/code]
    How to change the syntax to make the statement work from HR schema .
    Thank You .

    Smile,
    The questions is pretty much answered now. You might want to have a look at this as well.
    How to rename a table in another user's schema
    You can alter the session to set your current schema to the name of the schema where you want to rename the view and then do a direct rename.
    Thanks,
    Ishan

  • Select from a table from other schema

    Hi,
    I want to make a select from a table how is into other Schema and into other instance.
    form example, if I have _2 schemas (in diferent instances)_:
    SCHEMA1 =
    *(DESCRIPTION =*
    *(ADDRESS =*
    *(PROTOCOL = TCP)*
    *(HOST = XXX.XXX.XXX.XX1)*
    *(PORT = 1560)*
    *(CONNECT_DATA =*
    *(SERVER = DEDICATED)*
    *(SERVICE_NAME = SCHEMA1)*
    SCHEMA2 =
    *(DESCRIPTION =*
    *(ADDRESS =*
    *(PROTOCOL = TCP)*
    *(HOST = XXX.XXX.XXX.XX2)*
    *(PORT = 1560)*
    *(CONNECT_DATA =*
    *(SERVER = DEDICATED)*
    *(SERVICE_NAME = SCHEMA2)*
    and into SCHEMA2 there is a table TABLE_A.
    If I`m connected into SCHEMA1:
    how can I do to make a select from the TABLE_A?
    thanks very much.

    1) Referring to an entry in the tnsnames.ora file as a "schema" as you have here with schema1 and schema2 is likely to be confusing. You have multiple schemas in the same database-- in this case, you appear to be trying to query tables in a different database. If we try to answer using your TNS aliases "schema1" and "schema2", there is likely to be a great deal of confusion between schemas/ databases/ and TNS aliases. So I will assume that your tnsnames.ora file actually reads
    TNS_ALIAS1 =
      (DESCRIPTION =
        (ADDRESS =
          (PROTOCOL = TCP)
          (HOST = HOST1)
          (PORT = 1560)
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = DB1)
    TNS_ALIAS2 =
      (DESCRIPTION =
        (ADDRESS =
          (PROTOCOL = TCP)
          (HOST = HOST2)
          (PORT = 1560)
      (CONNECT_DATA =
        (SERVER = DEDICATED)
        (SERVICE_NAME = DB2)
    )2) Given the TNS aliases above, assuming that we are talking about the tnsnames.ora file on HOST1, you would need to create a database link from DB1 to DB2. You can either specify a fixed username and password for the database link or you can specify that the connection happens as the current user (which assumes that the passwords are synchronized between the databases).
    CREATE DATABASE LINK to_db2
      CONNECT TO username_on_db2
      IDENTIFIED BY password_on_db2
      USING 'TNS_ALIAS2'3) Assuming the database link is in place
    SELECT *
      FROM schema2.table_name@to_db2Justin

  • Using APIs from other shema

    I need some special grant to use portal apis from other shema.
    I trying to use wwctx_api.get_user_id API of this way
    declare
    x number;
    begin
    x := portal30.wwctx_api.get_user_id();
    end;
    but dont work, because return this error
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL30.WWCTX_SSO", line 562
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "PORTAL30.WWCTX_SSO", line 597
    ORA-06512: at "PORTAL30.WWCTX_API", line 82
    ORA-06512: at line 4
    null

    You need to run provsyns.sql. See the PDK on Portal Studio (PDK-PLSQL) for the download. It's also available on the iAS CD.

  • APEX  How do I create a Form based on a Database Table from other schema

    My APEX schema is WISEXP. I have a database table that resides in WISDW schema on the same database. I want to create Tabular form based on this table.
    I am not able to create a FORM based on the table from WISDW schema. I am able to create a FORM based on SQL though from this table in WISDW schema - but it does not do any action on Update/Insert rows.
    Appropriate Synonyms and grants are created. Is there a limitation or am I missing something? Please advise.
    thanks
    Rupen

    If Rupen is using 2.2 or 2.2.1, it is likely he is running into the bug described here: Re: Workspace to Schema Assignments
    In that case, it may be a necessary and sufficient workaround to assign the foreign schema to the workspace.
    Scott
    Message was edited by:
    sspadafo

  • How to open Viewer from other apps? - App 'URL Scheme' has disappeared from Viewer Builder!

    Hello
    The 'URL Scheme' option in the Viewer Builder did let me to specify a url that made other apps open my viewer. But this option has disappeared from the newer version of Viewer Builder. So. How do I do now to let other apps open my viewer?

    Is there a spacial reason that the URL scheme option was taken away from ordinary Multi-issue viewers? It was there in earlier version. I'll explain our situation:
    Our client want to publish corporate information; annual reports etc, with DPS. Not really magazines or newspapers you subscribe to.
    We are making another app where they publish news articles, videos etc. In that app, we want to have a link which opens the viewer with their publications.
    To make this simple thing work, we have to create a 'subscription' to content which is not relly good for subscribing (it is free and announced with push anyway). We also have to tell the client to create Privacy Policys etc for this. A lot of hassle for something we do not really want.
    Any chance that this option will come back in v19?

  • Geting  a data from others schemas

    Well I have the a problem I'm working in the schema Base and I need to know if an element exist in another schema , this schema is variable .
    I have make this code , but is not ok
    FUNCTION E_VEH (
    BD VARCHAR2, V_VE NUMBER )
    RETURN BOOLEAN
    IS
    NUMERO INTEGER;
    V_SENTENCIA VARCHAR2(500);
    BEGIN
    V_SENTENCIA:=' SELECT COUNT() INTO NUMERO FROM :A.VEH
    WHERE ID_VEH = :B' ;
    EXECUTE IMMEDIATE V_SENTENCIA USING BD,V_VE;
    RETURN (NUMERO > 0);
    END;

    Now I'm using the into stament but I'm getting the following error:
    11:44:38 Target session: ORA-01006: la variable ligada no existe
    This is my code :
    FUNCTION EX_VEH (
    BD VARCHAR2, D_VE NUMBER )
    RETURN BOOLEAN
    IS
    NUMERO INTEGER;
    V_SENTENCIA VARCHAR2(500);
    BEGIN
    V_SENTENCIA:=' SELECT COUNT(ID_VE) FROM :A.VEH WHERE ID_VEH = :B' ;
    EXECUTE IMMEDIATE V_SENTENCIA INTO NUMERO USING BD,V_ID_VEH;
    RETURN (NUMERO > 0);
    END;

  • I want the user to view all other schema

    hi all
    i have a project with 5 modules(GL, AP, AR, OM, PO) and each module has its own schema (tables,pkgs,views,.................)
    and i want to create a new user(test) that don't have any objects , i create it only to connect on forms by it
    and i want that user to access all other users objects
    NOTE:- i create a public synonym(inside each schema) to each table in each schema to access it by this synonym when i connect by user (test)
    but when i try to select from these synonyms it give me : insufficient privileges
    what can i do?
    thanks

    There are few ways of doing this
    1) Create a LOGON trigger for the user.
    In the logon trigger you will change the user to say GL, the use will be no need to qualify the objects with GL.object_name by default all references to OBJECT_NAME will be replaced by gl.object_name. the connected user wills till have his own priveleges which mean he still needs to have grants.Read more on LOGONG triggers
    2) Create Private Synonyms and and give grants to Individual users.
    3) My Preferred Method: Create a Role with all the required privelieges. Grant Role to users. This will save time everytime you create a new user.(This menthoed can be clubbed with the first method of creating logon trigger)
    Please do not create public synonyms.You WILL run into issues sooner or later when you start writing you own customized code.
    Regards,
    Bhushan

Maybe you are looking for

  • Plant to Plant STO with excise invoice and taxes in one company code

    Hi, I have a new business requirement, we want to create only one company code and 12 plants in different states,  each plant will have separate purchasing and sales activity this is ok this can be done with separate excise and series group as ther w

  • Reading Waveform (.hws) files from Analog Waveform Editor into LabVIEW causes read errors

    Hi Gang, In my application, I want to create files Using the Analog Waveform Editor and then, through LavVIEW, play them out through an D/A. I've not been able to read the .hws file into LV.  I've tried two methods: Using the Read Waveform VI in the

  • Pushbutton Text does not display in portal but display in development

    Hi Experts, I ceated Pushbutton in  selection screen block . Pushbutton text is does't display in portal view but display in development . i attached my coding , could you suggest anyother coding to diplay the pushbutton text. SELECTION-SCREEN BEGIN

  • Printing Problem in 6i

    Hi, I am facing a problem in printing from Reports 6i. We are using shared Laser Printer HP 4100 N. If i print report using this printer then 6i given General Page Fault (GPF) and comes out of program. Can anybody help me in resolving the issue. This

  • OTA update iOS

    I would like to ask does the iPhone auto-download OTA iOS updates? If it does, is there a way to disable it?