Call procedure across schema

I have oracle 8i
i have multiple identical schema for different country.
i write one procedure in one schema(country_1) and granted to all others for execute.
now i am connected to country_2 which doesn't have procedure,
and i am calling procedure of country_1(which has a procedure).
upto this everything is fine
but problem is i want to
execute the procedure on the recently connected schema(country_2),it is executing on country_1(where actual procedure is )
Thanks,
prathesh
([email protected])

You need to add AUTHID CURRENT_USER to your create procedure command.
From the documentation
invoker_rights_clause
The invoker_rights_clause lets you specify whether the procedure executes with the privileges and in the schema of the user who owns it or with the privileges and in the schema of CURRENT_USER.
This clause also determines how Oracle resolves external names in queries, DML operations, and dynamic SQL statements in the procedure.
TTFN
John

Similar Messages

  • How to prefix schema name to a called procedure?

    Hi,
    I have five different schemas and each and every schema has the same procedures and same set of tables.
    In calling procedure, there is one IN parameter which is schema name. In this procedure I am calling another procedure. In this scenario how to prefix schema name parameter to the called procedure?
    Urgent please.
    Thank you.

    Make use of Package constants:
    [list]
    [*]Create a package specification in each schema called REGION.
    [*]Create a Package specification constant CURRENT_SCHEMA string literal equal the owner of the REGION package.
    [*]This very very simple package (with no body) will be different in each of your five schemas. You must not transport this package between schemas.
    [*]For the procedures you are calling, redefine the argument of schema_name with a DEFAULT REGION.CURRENT_SCHEMA value. This should give you what you are looking to do - making all the procedure code (except for the REGION package spec) portable between the schema.
    [list]

  • Call procedure within procedure

    Hai
    I have some question
    1)
    This below procedure create user at run time
    ============================================
    create or replace procedure new_u1( p_name in varchar2,
    p_pw in varchar2,
    p_def_tblspace in varchar2 default 'users' )
    as
    begin
    execute immediate 'create user ' || P_name || ' identified by ' ||
    p_pw || ' default tablespace ' || p_def_tblspace ||
    ' temporary tablespace temp';
    execute immediate 'grant create session to ' || p_name;
    end;
    This below procedure create tables at run time
    ==============================================
    create or replace procedure M2 (table_name varchar2) as
    cursor1 integer;
    begin
    cursor1 := dbms_sql.open_cursor;
    dbms_sql.parse(cursor1, 'DROP TABLE ' || table_name,
    dbms_sql.v7);
    dbms_sql.close_cursor(cursor1);
    end;
    I want ,when first procedure calls ,it calls second procedure and create tables in that schema (call procedure within procedure).How to do that?
    2)What is diffrenece between row and statement level trigger?how many types of triggers?
    3)what is mutating trigger or table?
    4)dbms_stats.gather_table_stats package it collects the statistics about the tables .I want statistics to be collected at every day 9am and 7pm how to do that?
    Thanks in advance
    Mohan

    You could use an expression like this, to generate the run times:
    SQL> create table times (dt date) ;
    Table created.
    SQL> BEGIN
      2      FOR idx IN 1 .. 24
      3      LOOP
      4          INSERT INTO times VALUES (trunc(SYSDATE) + (idx / 24));
      5          INSERT INTO times VALUES (trunc(SYSDATE) + (idx / 24) + (1 / (24 * 60)));
      6          INSERT INTO times VALUES (trunc(SYSDATE) + (idx / 24) + (59 / (24 * 60)));
      7      END LOOP;
      8  END;
      9  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> SELECT to_char(dt,
      2                 'dd-mon-yyyy hh:mi:ss AM'),
      3         to_char(decode(sign(to_number(to_char(dt,
      4                                               'hh24MI')) - 900),
      5                        -1,
      6                        trunc(dt) + (9 / 24),
      7                        0,
      8                        trunc(dt) + (9 / 24),
      9                        decode(sign(to_number(to_char(dt,
    10                                                      'hh24MI')) - 1900),
    11                               -1,
    12                               trunc(dt) + (19 / 24),
    13                               0,
    14                               trunc(dt) + (19 / 24),
    15                               trunc(dt) + 1 + (9 / 24))),
    16                 'dd-mon-yyyy hh:mi:ss AM')
    17  FROM   times
    18  ORDER  BY dt
    19  /
    TO_CHAR(DT,'DD-MON-YYYY TO_CHAR(DECODE(SIGN(TO_
    01-jan-2004 01:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 01:01:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 01:59:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 02:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 02:01:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 02:59:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 03:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 03:01:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 03:59:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 04:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 04:01:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 04:59:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 05:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 05:01:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 05:59:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 06:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 06:01:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 06:59:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 07:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 07:01:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 07:59:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 08:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 08:01:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 08:59:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 09:00:00 AM 01-jan-2004 09:00:00 AM
    01-jan-2004 09:01:00 AM 01-jan-2004 07:00:00 PM
    01-jan-2004 09:59:00 AM 01-jan-2004 07:00:00 PM
    01-jan-2004 10:00:00 AM 01-jan-2004 07:00:00 PM
    01-jan-2004 10:01:00 AM 01-jan-2004 07:00:00 PM
    01-jan-2004 10:59:00 AM 01-jan-2004 07:00:00 PM
    01-jan-2004 11:00:00 AM 01-jan-2004 07:00:00 PM
    01-jan-2004 11:01:00 AM 01-jan-2004 07:00:00 PM
    01-jan-2004 11:59:00 AM 01-jan-2004 07:00:00 PM
    01-jan-2004 12:00:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 12:01:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 12:59:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 01:00:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 01:01:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 01:59:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 02:00:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 02:01:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 02:59:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 03:00:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 03:01:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 03:59:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 04:00:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 04:01:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 04:59:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 05:00:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 05:01:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 05:59:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 06:00:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 06:01:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 06:59:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 07:00:00 PM 01-jan-2004 07:00:00 PM
    01-jan-2004 07:01:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 07:59:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 08:00:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 08:01:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 08:59:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 09:00:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 09:01:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 09:59:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 10:00:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 10:01:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 10:59:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 11:00:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 11:01:00 PM 02-jan-2004 09:00:00 AM
    01-jan-2004 11:59:00 PM 02-jan-2004 09:00:00 AM
    02-jan-2004 12:00:00 AM 02-jan-2004 09:00:00 AM
    02-jan-2004 12:01:00 AM 02-jan-2004 09:00:00 AM
    02-jan-2004 12:59:00 AM 02-jan-2004 09:00:00 AM
    72 rows selected.
    SQL>

  • How to Call Procedure or Function

    Hi,
    How to call a procedure or function in apex, Please let me know
    Thanks
    Sudhir

    Hi,
    This post might help
    Re: How to Call procedure In Processes
    Regards,
    Jari

  • PRICING PROCEDURE-CALCULATION SCHEMA

    Dear All,
    There are some queries regarding pricing procedure calculation schema.Please help me out:
    1) What is the use of the "Requirement" column in calculation schema in real time scenario?
    2) What is meant by "Alternative calculation type" and "Alternative base value" column?What is its use in real time scenario?
    3) In the Print column if we place "X",it says "Printing at item level (previous procedure)".What does this actually means?
    4) What is the use of "Accurals" and what effect does it have in the pricing procedure and pricing calculation?
    For all the above queries  some real time scenario example willbe highly appreciable.
    Regards,
    Indranil

    1) What is the use of the "Requirement" column in calculation schema in real time scenario?
    Requirement
    Use
        If the requirement is fulfilled (SY-SUBRC = 0), then output
        determination also takes into consideration output type or the access
        sequence, for which the requirement has been specified.
    Examples
        A possible requirement would be, for example, that a difference shoul
        be made between document currency and local currency .
    Definition
         Number of a subroutine (= form routine), that checks a requirement at a
         specific time.
    Use
         The standard SAP system contains some standard routines for checking
         requirements when copying. You can also define your own routines
         according to the needs of your company.
    Example
         If you copy a quotation to a sales order, the system can check every
         quotation item to ensure that the customer had not rejected them for any
         reason.
    2) What is meant by "Alternative calculation type" and "Alternative base value" column?What is its use in real time scenario?
    If you are using any Formula to Derive the Condition Type then you can use  Alternative formula to the formula in the standard system that
    determines a condition.
    Alternative formula for condition base value
         Formula for determining the condition basis as an alternative to t
         standard.
    Example
         An absolute header discount is, for example, distributed in the st
         system according to the cumulative value of the items.
         If the system, however, distributes the absolute header discount
         according to volume, a header discount of $30 results in the follo
         discounts:
         Item       Value  Volume              Discount
                                      Stand. disc.   Volume disc.
           1        $1000  2 cbm         $20             $10
           2        $500   4 cbm         $10             $20
    3) In the Print column if we place "X",it says "Printing at item level (previous procedure)".What does this actually means?
    If you Put 'X" , it will be shown in the Print Output..
    Print ID for condition lines
         Controls issue of condition lines when printing documents such as order
         confirmations or invoices.
    Use
         In releases previous to 4.0, the following print indicators are
         available :
         o   ' ' : Condition line is not printed
         o   'X' : Condition line is printed at item level
         o   'S' : Condition line is printed in totals block
         The following standard logic is set out for these printing indicators:

  • Getting NLS setting issues when calling procedure

    Hi,
    Can anybody suggest me what could the problem in the below issue?.
    i am invokeing procedure using DBAdapter. My soa version is 11.1.1.5. When i am calling procedure first time it is working fine. But when i am invoke second time
    it is showing below error. I observed that i am getting error alternativly. So kinldy advice me what could be the issue.
    Error:
    Cause: java.sql.SQLException: ORA-20001: Oracle error -20001: ORA-20001: Oracle error -2074: ORA-02074: cannot SET NLS in a distributed transaction has been detected in fnd_global.set_nls.set_parameter('NLS_LANGUAGE','AMERICAN'). has been detected in fnd_global.set_nls. ORA-06512: at "APPS.APP_EXCEPTION", line 72 ORA-06512: at "APPS.FND_GLOBAL", line 240 ORA-06512: at "APPS.FND_GLOBAL", line 1410 ORA-06512: at "APPS.FND_GLOBAL", line 1655 ORA-06512: at "APPS.FND_GLOBAL", line 2171 ORA-06512: at "APPS.FND_GLOBAL", line 2313 ORA-06512: at "APPS.FND_GLOBAL", line 2251 ORA-06512: at
    Regards,
    Adhi

    Hi:
    Another way to avoid this, is to use an Non-XA Datasource.
    Hope this helps
    best

  • How I call procedure  in interactive report??

    Hi
    Is possible that call procedure in interactive report on APEX?
    Because
    in region source it asked only sql statement so I am confused and I dont know how call procedure in interactive report ?
    Edited by: esra aktas on 12.May.2011 11:04
    Edited by: esra aktas on 12.May.2011 12:05

    I am confused... Now, acoording to my senior porject in school my advisor want to that lots of procedures' name and arguments that I have collect them in a table. I collected procedures in table then I wrote a procedure that call wanted procedure by using dynamic sql and run that procedure..I select procedure name on selectlist on apex then that procedure run.
    So I want to my procedure's results must be as dataset in report . But report's source want to sql statement but I want to call the procedure as I mentioned.
    If you have any idea about my situations , I want to get your adviced.
    I have a this procedure.
    create or replace
    PROCEDURE CALLSPFROMTABLE(id number,arg1 varchar2,arg2 varchar2)  as
    table_name varchar2(30):='procedures';
    procname varchar2(1000);
    begin
    EXECUTE IMMEDIATE 'select procname from ' || table_name || ' where id='||id into procname;
    EXECUTE IMMEDIATE 'BEGIN '||procname||'('||arg1||','||arg2||'); END;';
    END;id=>:p1_SP , arg1=>:P1_YIL arg2=>:P1_BIRIM from selectlists
    Edited by: esra aktas on 12.May.2011 13:08
    Edited by: esra aktas on 12.May.2011 13:17

  • Call procedure while creating view in hana.

    Can we call procedure while creating a attribute view like
    CREATE VIEW "PAYROLLDBTEST"."@HourTransactionView"
    "DocEntry",
    "DocNum",
    "EmpID",
    "EmpCode",
    "FullName",
    "TableName",
    "TranName",
    "U_FromDate",
    "U_ToDate",
    "NoOfDays",
    "U_FromTime",
    "U_ToTime",
    "NoOfHours",
    "OvertimeHours",
    "UnpaidDays",
    "Weekends",
    "Holidays",
    "U_Remarks",
    "U_BatchNo",
    "ProjectCode"
    ) AS SELECT
      T0."DocEntry" AS DocEntry,
        T0."DocNum" AS DocNum,
       T0."U_EmpCode" AS EmpID,
    CALL PAYROLLDBTEST.GetEmpCodeFromEmployeeID('EmpID')  ,              (getting syntax error here).
        GetEmployeeFullName("@TRANSACTION_HOURS".U_EmpCode) AS FullName,
          T0."U_TransactionType" AS TranCode,
        GetHourTableName("U_TransactionType") AS TableName,
         GetHourTransactionName("U_TransactionType") AS TranName,
        T0."U_FromDate",
        T0. "U_ToDate",
          DAYS_BETWEEN("U_FromDate", "U_ToDate") + 1 AS NoOfDays,
          T0."U_FromTime" AS U_FromTime,
           T0."U_ToTime" AS U_ToTime,
        IFNULL("U_WorkHours", 0) AS NoOfHours,
         IFNULL("U_OvertimeHours", 0) AS OvertimeHours,
        IFNULL("U_PaidDays", 0) AS PaidDays,
         IFNULL("U_UnpaidDays", 0) AS UnpaidDays,
        IFNULL("U_WeekendsCount", 0) AS Weekends,
         IFNULL("U_HolidaysCount", 0) AS Holidays,
          T0."U_Remarks",
           T0."U_BatchNo",
        T0."U_ProjectCode" AS "ProjectCode"
        FROM
        "@TRANSACTION_HOURS" T0
        INNER JOIN
        "OHEM" T1
        ON
         T1."empID" = T0."U_EmpCode";

    Hello,
    The problem could be a SAPGUI related problem... Whats the current sapgui patch level ? Does it work when you try on another wokstation with the same user ?
    Could you please use SAPGUI 720 and update your patch level to 7 ? Then check the behaviour again.
    Best regards
    Rene

  • Exception handling in calling procedure

    Hi,
    i have a package where currently am making calls to private procedures from public procedure.
    and the senario is:-
    create package body p_tst
    is
    ex_failed exception;
    -- this is private proc
    procedure p_private
    is
    begin
    raise ex_failed;
    exception
    when ex_failed
    then
    raise;
    end p_private;
    procedure p_public
    is
    begin
    -- nomaking call to private
    -- procedure
    p_private;
    -- here i need to catch
    -- the raised exception
    -- passed from the called
    -- procedure
    when ex_failed
    end p_public;
    end;
    basically i want to catch the exception being passed from called procedure to calling procedure, and raise the same exception in calling procdure.
    is it possible to catch the same exception in the calling procedure?

    Yes, you can catch the same exception in the calling procedure, exceptions are propagated to the caller if they are not handled in the called procedure.
    Is this what you are trying to do?
    CREATE OR REPLACE PACKAGE p_tst
    AS
       PROCEDURE p_public;
       ex_failed   EXCEPTION;
    END;
    CREATE OR REPLACE PACKAGE BODY p_tst
    IS
       PROCEDURE p_private
       IS
       BEGIN
          RAISE ex_failed;
       END p_private;
       PROCEDURE p_public
       IS
       BEGIN
          p_private;
       EXCEPTION
          WHEN ex_failed
          THEN
             DBMS_OUTPUT.put_line ('error');
       END p_public;
    END;
    SQL> set serveroutput on;
    SQL> exec p_tst.p_public;
    error
    PL/SQL procedure successfully completed.

  • How to call procedure in Java from SQL Server Database

    Hello Every Body
    i Have Question about
    How to call procedure in Java from SQL Server Database
    Thanks

    Hi,
    have you tried a Google search? I just gave it a 3 second try and already found: http://stackoverflow.com/questions/6113674/how-do-i-execute-a-ms-sql-server-stored-procedure-in-java-jsp-returning-table-d
    Frank

  • How to call procedure from java

    My database : oracle xe 10g
    I develop my application by use jdeveloper
    I call procedure following code :
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection c = (Connection)DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "shm", "shm");
    CallableStatement cs = c.prepareCall("begin shm_increase_capital.ins_upd_tb_payment_rec_pc(:1,:2,:3,:4,:5,:6,:7);end;");
    cs.setLong(1, shareHolderId);
    cs.setString(2, companyCode);
    cs.setString(3, lotYear);
    cs.setLong(4, seqLot);
    cs.setLong(5, allocateId);
    cs.setLong(6, originateFrom);
    cs.setString(7, curUser);
    cs.execute();
    cs.close();
    c.close();
    When I run my application several times I found error :
    Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12519, TNS:no appropriate service handler found
    The Connection descriptor used by the client was:
    localhost:1521:XE
    Do you have another way for call procedure
    Please recommend me
    Thank you,
    Ja-ae

    I can call procedure
    but when I using my application too long
    I found error :
    Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12519, TNS:no appropriate service handler found
    The Connection descriptor used by the client was:
    localhost:1521:XE
    so, I think perhaps another way to call procedure for avoid this error

  • PLS HELP - Column value missing when calling procedure from Oracle OLEDB provider

    When calling procedure 'sp_a(?,?,?)' from SQL_PLUS and using
    DBMS.OUTPUT to print the result
    It returns a result set as
    C0, C1, C2
    But When I call the same procedure 'sp_a(?,?,?)' with same
    parameter value from MS VB6,
    It returns the a result set as
    C0, Null,C2
    The 2nd value became Null.
    Any ideas?
    Please Help.

    See http://oracle.ittoolbox.com/groups/technical-functional/oracle-apps-l/forms-personalization-execute-a-procedure-1778674

  • Call procedure when add item

    Hello,
    Is any way to call procedure when you add and item in oracle portal (not after)? Example when you add a item text and you see the form to add all content is any way to call a procedure in this form?
    Thanks
    Edited by: user533544 on 6/Abr/2009 2:12

    Hi Orlando -
    In the next major portal release this functionality will be available. We call it the Content Management Event Framework. This event framework lets you react on any event that happens in your portal CM system.
    In the current release, you can implement a workaround by using database triggers on the Content Management (CM) views/tables. The CM views are documented here: http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1012/wwsbr_api_view.html
    Hope this helps,
    Candace

  • Call procedure without specifcation from shell scrip

    I am writing shell script. In that I am calling one of the procedure lets say "ABC" from package "V".
    exec V.abc ();
    problem is that procedure ABC does not have specifications in package. It has only body defined.
    I am getting error as procedure undefined.
    Is there any way to call procedure in the BODY part without specifications.
    Problem here is package is not owned by me so I can not change anything in that .
    Please suggest.
    Thanks in advance.

    No, the procedure is private in the package body. You can't access it if it is not in the package specification.
    Ask the owner of the package to declare it in the package specification, make it public...
    How do you know that this procedure exists anyway?

  • Why can't we call procedure in sql stmt

    Hi,
    Why can't we call procedure in sql stmt?

    Assuming (as Billy mentioned) that the question refers to SELECT statements (also assuming that "stmt" is short for "statement", nice time-saving abbreviation, thanks for that), you cannot use procedures because there is no concept of a procedure in an SQL query, and possibly in declarative languages in general (computer scientists may correct me here).
    How would it work? Everything in a SELECT list has to return something - it's the whole point of a SELECT list. Procedures by definition do not have a RETURN clause (yes you can RETURN to end processing, yes there are OUT parameters, but that is not the same thing). Perhaps you could post an example of the syntax you have in mind.

Maybe you are looking for