Help on calling proc in another schema

Hi,
How to call a procedure that resides in another schema?
i used the following syntax
declare
v_id number;
BEGIN
EXECUTE IMMEDIATE 'DECLARE
BEGIN
fnm.PERFVESTADJUSTASOF@to_cefsd001('||v_id||',SYSDATE,null, null, FALSE, FALSE);
END;';
EXCEPTION
WHEN OTHERS THEN
vj_debug_fasb('mat1',sqlerrm);
END ;
but i get the error:
ORA-06550: line 3, column 50: PLS-00103: Encountered the symbol "," when expecting one of the following: ( ) - + case mod new not null others <an identifier> <a double-quoted delimited-identifier> <a bind variable> table avg count current exists max min prior sql stddev sum variance execute multiset the both leading trailing forall merge year month DAY_ hour minute second timezone_hour timezone_minute timezone_region timezone_abbr time timestamp interval date <a string literal wit
If i execute this from the other schema(where the proc resides) it works.
Any idea about this???
Thanks in advance for ur help....
thanks,
Mathew

Now i am getting another error:
declare
BEGIN
Execute immediate 'declare
v_id number;
BEGIN
fnm.PERFVESTADJUSTASOF@to_cefsd001 (v_id,sysdate , -1,-1, FALSE, FALSE);
commit;
END;';
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(substr(sqlerrm,1,200));
END ;
Error:
ORA-00164: autonomous transaction disallowed within distributed transaction
any idea on this?

Similar Messages

  • VPD: Problems calling a function on another schema

    Here's the setup:
    I've create a schema called "AllYourBase".  It contains all of my tables, views, functions, procs, etc.
    These tables are protected by a DBMS_RLS policy.  The policy uses a function to define its predicate which looks like this:
    create or replace function tous_filter(schemaName varchar2, tableName varchar2)
    return varchar2 is
    begin
    return  'account = sys_context(''USERENV'', ''CLIENT_IDENTIFIER'')';
    end;
    All of the tables have an account column for this to work.  So far, this is a pretty basic VPD setup.
    I have other db users that login and view data in the "AllYourBase" schema.
    So when "ArbyLong" logs in, I set sys_context('USERENV', 'CLIENT_IDENTIFIER') to "ArbyLong", and when he runs a query, he gets back his rows.
    Now, "AllYourBase" has several functions.  Here's a very contrived, simplified example of one (but it illustrates the issue I'm running into just fine):
    create or replace function getUserID
    return integer is retval integer;
    begin
    select user_id into retval from users;
    return (retval);
    end;
    When "ArbyLong" runs the equivalent query (select user_id from users), he gets back the one row where the account column is equal to "ArbyLong", as expected.
    But this getUserID function lives in the "AllYourBase" schema.  And here's the catch: I've made "AllYourBase" exempt from the policies by running "grant exempt access policy to AllYourBase".
    When "ArbyLong" runs the function getUserID, it runs in the "AllYourBase" schema and pulls ALL of the rows from the users table.
    This particular function simply errors out (since it's only expecting one row), but other functions are returning data that the logged in user shouldn't see.
    So even though there are policies in place, by calling a function on another schema who is exempt from the policies, a user is able to see all returned data and not just the rows they are normally limited to.
    Ultimately my question is this: Is there a way to enforce VPD policies when a user calls a function that lives in another schema?
    Doing my own research, the answers I've come up with are:
    * Don't use "grant exempt policy"!
    * Put the function directly into the users' schemas.  So "ArbyLong" would have his own getUserID function that would look at the "AllYourBase" users table.
    I'd rather not do either of these, so does anyone have any other ideas?  If it turns out these are the only solutions, then I'll go with one of them.
    Thanks!

    Need more info. Are you using a ViewStack or other navigator container, and trying to access a view that has not been displayed yet, due to deferred instantiation?
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • Calling a procedure that exist in another schema

    hello , i need your help .
    i would like to know how i can call a procedure that exist in another schema
    what i did for example calling the procedure "proc" at schema "user1" from pl/sql code
    begin
    user1.proc(parm1,parm2);
    end;
    i got the error message
    (1): PLS-00201: identifier 'user1.proc' must be declared
    (2): PL/SQL: Statement ignored
    but by calling it from SQL PLUS from the same current schema i got no errors
    exec user1.proc(parm1,parm2);
    thank you

    Assuming that the call that is failing is located in a stored procedure or stored function, the problem is likely that your user's access to the user1.proc procedure is via a role and privileges granted through a role cannot be used in a definer's rights stored procedure or stored function.
    You can verify this by disabling roles in your SQL*Plus session. If you do
    SQL> set role none
    SQL> exec user1.proc( p1, p2 );I would expect that you'll get the same error that you get in your stored procedure. Assuming that is the case, you'll need to ask the DBA to grant your user EXECUTE access on user1.proc directly not via a role.
    Justin

  • Cannt execute stored proc of one schema in another schema from java app.

    I am posting my problem in this forum as i i though it could be server-independent.
    I am working on apache tomcat and spring framework with Oracle db (schema/user A)
    We access oracle db from our java application by setting jndi and works fine.We have sqlstatements, stored procs and functions all run fine.
    Now we create a role (DBROLE) with all permissions to that original db schema/user(A) . We created another empty schema B and assigned that role(DBROLE) to that user B.
    (We grant all kind of permissions on tables/packages of schema A to user role DBROLE and also created synonyms)
    Intentions are: to access the schema A though schema B from application and avoiding direct access.
    In our spring application, we replaced database-settings with schema B.
    Things work fine: When its plain SQL statement is run from Java code but Stored proc wont run and we get
    'Wrong num of arguments/data types' error.
    Also all stored procs are in packages.To execute stored proc in java code, we use SimpleJdbcCall.
    I also checked run stored proc from schema B and its works. Only from web app, it doesnt work.
    Please suggest,what should be done to make this working or if there is other alternative.
    Thanks

    Instead of importing a scema in another schema specifiy the schemas in the external-schemaLocation property.
    SAXParser saxParser = new SAXParser();
    saxParser.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", "xmlschema1.xsd, xmlschema2.xsd");

  • Calling PL/SQL Procedure In Another Schema Gives Unexpected Result

    I have a SQL Script that does this:
    conn pnr/<password for user pnr>;
    set serveroutput on;
    exec vms.disable_all_fk_constraints;
    SELECT owner, constraint_name, status FROM user_constraints WHERE constraint_type = 'R';
    and the disable_all_fk_constraints procedure that is owned by user 'vms' is defined as:
    create or replace
    procedure disable_all_fk_constraints is
    v_sql   VARCHAR2(4000);
    begin
    dbms_output.put_line('Disabling all referential integrity constraints.');
    for rec in (SELECT table_name, constraint_name FROM user_constraints WHERE constraint_type='R') loop
    dbms_output.put_line('Disabling constraint ' || rec.constraint_name || ' from ' || rec.table_name || '.');
    v_sql := 'ALTER TABLE ' || rec.table_name || ' DISABLE CONSTRAINT ' || rec.constraint_name;
    execute immediate(v_sql);
    end loop;
    end;
    When I run the SQL script, the call to vms.disable_all_fk_constraints disables the FK constrains in the 'vms' schema, whereas I wanted it to disable the FK constraints in the 'pnr' schema (the invoker of the procedure). I know that I could make this work by copying the disable_all_fk_constraints procedure to the 'pnr' schema and calling it as "+exec disable_all_fk_constraints;+" from within the SQL script but I want to avoid having to duplicate the PL/SQL procedure in each schema that uses it.
    What can I do?
    Thank you

    You have two issues to solve.
    First you need to write a packaged procedure that works with INVOKER rights. The default is DEFINER rights.
    The difference is excatly what you need. Usually the package has the rights from the schema where it is defined (=Definer rights). In your case schema VMS. Whereas you need the privileges from the user that calls the package (PNR).
    => Check out the documentation for INVOKER rights
    The second problem is that the view "user_constraints" will not give the results you expect when called from inside a procedure in another schema. An alternative could be to use the view DBA_CONSTRAINTS with a filter on the owner (where owner = 'PNR'). Not sure if there are other working possibilities. Well you could create a list of constraint names that you want to disable, instead of creating the list dynamically.
    And you could have another potential disaster creeping up upon you. If you run this thing, then at this moment you don't have any referential integrity anymore. You can't be sure that you can create the FKs again after this action. This is EXTREMLY DANGEROUS. I would never ever do this in any kind of production or test database. I would be very careful when I do it on a development database.

  • Help in writing  query few schema objects  from another schema.

    Hi Gurus,
    Could some one help in writing an sql which will give list of all the object of a schema "genp" visible in another schema "genp_v" and "gen_con" there is an dblink and few grants on those schemas .
    i dont have the password of any of those users i have connected as sys and i can not change the password of any of those users..
    Any help on this is highly apprciated.
    Thanks in advance .

    could you please update me for all the objects apart from just the tables .
    thank you so much .. it was just out of my head at that moment .
    cheers

  • Exp XML Schema (.xsd) to another schema on same instance

    Hello,
    I hope someone on this forum can help me or point me in the correct direction. I want to export a schema which contains a table (EQUIPMENT) which has a XMLType column defined against a registered .xsd. I would then like to restored this schema to another schema on the same instance (development instance) and also onto another db instance.
    I have been trying to do this with the help of "Chapter 30 Importing and Exporting XMLType Tables" from the Oracle® XML DB Developer's Guide
    10g Release 2 (10.2). Unfortunately without success. At the end of this message I have encluded sample error messages that I am receiving for creation of TYPES which is causing my import to fail.
    I cannot find any examples on the web on how to achieve an exp from one schema and imp in another either on the same instance or another one.
    DDL for my table is :
    create table EQUIPMENT
    ID number(7) not null,
    STATUSID number(7) not null,
    ATTRIBUTEDATA xmltype
    xmltype column ATTRIBUTEDATA xmlschema "EQUIPMENT.xsd" element EQUIPMENT_XML
    tablespace TBS_DATA1;
    Three test runs as follows:
    1. Using an empty u2 schema and I register the .xsd file. Then I try to import (FROMUSER - TOUSER imp mode) my dump file which leads to the following error:
    IMP-00017: following statement failed with ORACLE error 2304:
    "CREATE TYPE "MTA1440_T" TIMESTAMP '2007-11-14:14:42:16' OID '3EE57B10307317"
    "74E044080020C94102' AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T",""
    "ATTRIBUTE_01" NUMBER(38),"ATTRIBUTE_02" VARCHAR2(4000 CHAR),"ATTRIBUTE_03" "
    "VARCHAR2(4000 CHAR),"ATTRIBUTE_04" NUMBER(38),"ATTRIBUTE_05" VARCHAR2(4000 "
    "CHAR))FINAL INSTANTIABLE "
    IMP-00003: ORACLE error 2304 encountered
    NOTE: Even though import failed, I now see a new TYPE created called "MTA1526_T".
    2. If I try to create the TYPE as is from the error above I get the following error:
    SQL> CREATE TYPE MTA1440_T
    2 OID '3EE57B1030731774E044080020C94102'
    3 AS OBJECT (SYS_XDBPD$ XDB.XDB$RAW_LIST_T,
    4 ATTRIBUTE_01 NUMBER(38),
    5 ATTRIBUTE_02 VARCHAR2(4000 CHAR),
    6 ATTRIBUTE_03 VARCHAR2(4000 CHAR),
    7 ATTRIBUTE_04 NUMBER(38),
    8 ATTRIBUTE_05 VARCHAR2(4000 CHAR)) FINAL INSTANTIABLE;
    9 /
    CREATE TYPE MTA1440_T
    ERROR at line 1:
    ORA-02304: invalid object identifier literal
    3. So now I create the "MTA1440_T" type without the OID value and retry the import.
    IMP-00061: Warning: Object type "U2"."MTA1440_T" already exists with a different identifier
    "CREATE TYPE "MTA1440_T" TIMESTAMP '2007-11-14:14:42:16' OID '3EE57B10307317"
    "74E044080020C94102' AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T",""
    "ATTRIBUTE_01" NUMBER(38),"ATTRIBUTE_02" VARCHAR2(4000 CHAR),"ATTRIBUTE_03" "
    "VARCHAR2(4000 CHAR),"ATTRIBUTE_04" NUMBER(38),"ATTRIBUTE_05" VARCHAR2(4000 "
    "CHAR))FINAL INSTANTIABLE "
    Questions from me:
    A. Can I export TYPES only as suggested by the online documentation ?
    B. If importing onto same instance in another schema surely the OID for the TYPE will always fail - so then why can the import not create the required TYPE name itself during the import ?
    C. Should I use global TYPES and Register the .XSD globally for all schema's in an instance to validate against .. would this prevent me from having errors on an import ?
    I would appreciate any insight any one could provide me. Many thanks in advance.
    Dom

    Hi Guys,
    Thank you all for the replies. I am dissappointed to hear that in 10g does not support exp/imp of schema's structured XML. However I am a little confused or should I say mislead by the "" documentation I
    Here is an extract from chapter "30 - Importing and Exporting XMLType Tables" from the Oracle XML DB 10g Developers Guide documentation:
    "..... Oracle Database supports the import and export of XML schema-based XMLType tables. An XMLType table depends on the XML schema used to define it. Similarly the XML schema has dependencies on the SQL object types created or specified for it. Thus, exporting a user with XML schema-based XMLType tables, consists of the following steps:
    1. Exporting SQL Types During XML Schema Registration. As a part of the XML
    schema registration process .....
    2. Exporting XML Schemas. After all the types are exported, XML schemas are
    exported as XML text .....
    3. Exporting XML Tables. The next step is to export the tables. Export of each table consists of two steps:
    A. The table definition is exported as a part of the CREATE TABLE statement....
    B. The data in the table is exported as XML text. Note that data for out-of-line
    tables is.....
    From this documentation I was under the impression that the exp/imp of XML Schema-Based XMLType Tables was supported.
    Regarding the backup mechanism/strategy for database schema's containing tables with Schema-Based XMLTypes what would you recommend the best online backup method to use - tablespace backups ?
    What I need to be able to do in day-to-day work is to have the ability to be able to take a copy of a customers UAT or production database schema and apply it to a dev or test db instance here for bug testing etc. Do you have any advice on best to achieve this without the use of an exp/imp when the schema will contain Schema-Based XMLType tables.
    Thank you all for your assistance so far.

  • Importing (imp) a dump (exp) from a schema into another schema

    Hello
    -I know I should read the manual-
    -I also know that there are some experts here who only need two lines to explain it- :)
    I have a dump file from a complete schema (lets call it xx).
    I habe another schema (yy) in the same database and:
    I would like to put that dump file into the schema yy.
    How does the imp command looks like?
    Thank you in advance!

    How does the imp command looks like? To get help say at OS prompt.
    imp help=y
    -aijaz

  • Export One Schema to Another Schema

    Hi
    I would like to export some of my tables from one schema to another schema.
    Can you help me on this
    regards
    Ghouse

    Here you resuire two steps EXPORT AND IMPORT
    STEP-1
    First run the export utility (name EXP80.EXE) in the ORANT\BIN directory and make the .DMP file.
    STEP-2
    Secondly run the import utility (name IMP80.EXE) in the ORANT\BIN directory and call the above .DMP file
    ===============
    THE END
    ===============

  • Accesing the tables of one schema in another schema

    Hi
    I have doubt .. suppose i have a user called DEMO and it has tables . now i have a another user called DEMO1
    my doubt is . how can i get the tables of DEMO user into DEMO1. If update the table in DEMO1 that should reflect
    in DEMO user. help me.........

    Before going further, you should clarify your requirements and make sure you have a good understanding of:
    - Synonyms
    - Views
    - Replication such as materialized views
    - Basic security including object grants
    Assuming this is all in the same database...
    If you just need to have one user access data in another schema, you need grants.
    If you need to make it 'look like' the data in that other schema is in your schema, you should be looking at synonyms or views.
    If you need to capture the data periodically from the other schema, you should be looking at materialized views.
    If you are straddling multiple databases then the choices may be less clear-cut but you should still be looking at these capabilities to assemble a solution
    From what you have said so far, triggers should not even be on your radar.

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • How do I view package bodies in another schema ?

    For purposes of SOX and security/audit control, we log in under our network id's in our production environment. We have sourcecode compiled into Oracle seeded schemas ( APPS ) so that scheduled jobs are able to run with submitted from the Oracle Applications environment. We don't compile code into our personal network account areas.
    I know how to GRANT EXECUTE privs so that we can execute a package in another schema, but what I want to do is to be able to view the sourcecode in another schema. Compile into APPS but be able to see the package body from my network id schema account.
    I can't seem to find what the correct permission is anywhere. Granted I can look at DBA_SOURCE to get to it, but I want to use a tool like SQL Developer or TOAD to look at the code in a more presentable and easier to debug manner.
    Any help ?

    I did some more searching on the forum... seems its already a request... TOAD gives access to DBA_Views to resolve the issue... SQL Developer has not integrated that functionality yet, but forum entries seem to indicate that it is on the horizon.
    Thanks for responding though.
    ~Barry

  • How to share data in "User_*" tables with another schema

    I would like to share the data in the USER_SEGMENTS table with another schema. If I create a view and grant select on the view, when the other schema queries the view the data is identical to themselves querying the SYS.user_segments table directly.
    create view sys_user_segments as select * from sys.user_segments;
    grant select on sys_user_segments to A;My guess is that the SYS.user_segments table is a view based on the current user.
    Is there a way to share this data without creating a copy of the table?
    Oracle: 10g
    Thanks

    Hi,
    All the data dictionary "tables" whose names start with user_ (or all_ or dba_) are actually views, and what results they bring back depend on what schema you logged in to. I don't think there's any way to allow user A to directly see what's in user B's version of user_segments.
    Why do you need this? Can you use the all_ views instead, by giving A some privileges on B's objects?
    Failing that, you can replicate the data into a regular table. Inside a AUTHID DEFINER stored procedure, the data dictionary views (such as user_segments) are the versions of the procedure owner, so B can write a stored procedure (let's call it populate_my_segments) that populates a regular table (let's call it my_segements), and then grant EXECUTE privilges on populat_my_segments and SELECT privileges on my_segements to user A. A can then refresh the table and look at it whenever he wants to.
    If A only needs to see a little information, e.g. the total number of bytes, from B's user_segments, then B can write a function just to return that information.

  • How to refer global simple types in another schema?

    Hello All,
    Any help would be greatly appreciated. My problem is , I have a global.xsd schema which declare simple types such as
    <xsd:simpleType name="DecimalMin1Max14Places2Type">
    <xsd:restriction base="xsd:decimal">
    <xsd:totalDigits value="14"/>
    <xsd:fractionDigits value="2"/>
    </xsd:restriction>
    </xsd:simpleType>
    I am referring to this type in my another schema forms.xsd. It is used as an attribute to an element. for example an element in forms.xsd is
    <xsd:element name="BudgetFourthYearAmount" type="glob:DecimalMin1Max14Places2Type"/>
    where glob is the prefix associated with global.xsd
    I am sucessfully able to register global.xsd in xdb, but when i try to register forms.xsd, i get sql mapping error. Oracle is able to resolve all the global elements from global.xsd , but it cannot resolve the global simple types i declared.
    My question is how i can refer global simple types declared in one xsd and use them in another xsd?
    Thank you,
    Maninder

    Using an include statement in forms.xsd to import in the global.xsd
    <xs:include schemaLocation="Global.xsd"/>
    If Global.xsd was the shcema_url that you registered the first xsd to.
    Regards
    Coby

  • Spatial query on view to another schema

    Hi,
    I am getting the following error on this query :
    select ufi from cadastre where
    sdo_filter(geometry,
    mdsys.sdo_geometry(2003,8311,NULL,
    sdo_elem_info_array(1,1003,3),
    sdo_ordinate_array(130.967,-12.510,131.000,-12.486))) = 'TRUE';
    ORA-13226: interface not supported without a spatial index
    Cadastre is a view of a table stored in another schema.
    This query works :
    select ufi from sdo_owner.parcel where
    sdo_filter(geometry,
    mdsys.sdo_geometry(2003,8311,NULL,
    sdo_elem_info_array(1,1003,3),
    sdo_ordinate_array(130.967,-12.510,131.000,-12.486))) = 'TRUE';
    I have an entry in user_sdo_geom_metadata for CADASTRE , do i also need an entry in user_sdo_index_info for the query to work.
    Does any one have any ideas ?
    James

    Dan,
    I have worked out why it happens. We have a parcel table that is made up of polygons and points. The points are parcel's that have no legal boundary or survey boundary, just a point where a house might be located.
    What i had forgotten was that i had created a function to convert these points into a polygon on the fly. This buffer function is called from the view.
    example
    create view cadastre
    as
    select
    ufi,
    parcel_key,
    buffer(geometry) "GEOMETRY"
    from sdo_owner.parcel;
    I am guessing that because the geometry is no longer geometry from a table but created geometry it does not have a spatial index associated with it.
    Here is the buffer function
    CREATE OR REPLACE FUNCTION buffer
    geometry MDSYS.SDO_GEOMETRY,
    layer_name VARCHAR2
    RETURN MDSYS.SDO_GEOMETRY
    AS
    temp_geom MDSYS.SDO_GEOMETRY;
    diminfo MDSYS.SDO_DIM_ARRAY;
    start_x FLOAT;
    start_y FLOAT;
    end_x FLOAT;
    end_y FLOAT;
    BEGIN
    SELECT u.diminfo INTO diminfo
    FROM user_sdo_geom_metadata u
    WHERE u.table_name = UPPER(layer_name);
    IF geometry.GET_GTYPE() = 1 THEN
    temp_geom := sdo_geom.sdo_buffer(geometry,diminfo,4,'units=m arc_tolerance=0.005');
    return temp_geom;
    END IF;
    IF geometry.GET_GTYPE() = 2 THEN
    temp_geom := sdo_geom.sdo_buffer(geometry,diminfo,4,'units=m arc_tolerance=0.005');
    RETURN temp_geom;
    END IF;
    IF geometry.GET_GTYPE() = 6 THEN
    temp_geom := sdo_geom.sdo_buffer(geometry,diminfo,4,'units=m arc_tolerance=0.005');
    RETURN temp_geom;
    END IF;
    RETURN geometry;
    END;
    James

Maybe you are looking for

  • Security error while Editing Process task 11gR2

    Hi Experts, I have made a custom adaptor and trying to implement same on the Xellerate User, Add user task under task dependency --> Dependent Task. While actually inserting the adaptor task, i am recieving the error: Error Keyword: DOBJ.INVALID_UPDA

  • Audition CS6 files not showing in PPro

    From PPro, I did the "Edit...Edit in Adobe Audition...Sequence" command. This opened the all the clip audio files as a group in Audition as expected. Got done with editing in Audition, saved projected in Audition via "File...Save" command. Go back to

  • How to clear combobox

    Hi All, I want to fill my combobox on the basis of values selected in other combobox. For this I have to Clear the combobox. I have used Remove method with SAPbouiCOM.BoSearchKey.psk_Index. But its giving error. Whats the process to Clear Combobox. T

  • Java 1.6.0_update29+ problem / unsupported

    After updating to Java 1.6.0_29, all TES 5.3.1 and 6.0.x releases configured for Microsoft SQL servers will no longer work. This is an issue relating to a severe bug in the Java 1.6.0_29 version, therefore, all Enterprise Scheduler customers are stro

  • Windows Login Name and Password

    Hi, I am developing an application, which requires the windows login name for greeting and password for validating and granting privileges. Could someone please give me the pseudo code for getting the windows login name and password. Thanks, Mitra.