Execute procedure over db link

I am trying to execute a stored procedure over database link and I get the following error
DBMS_APPLY_ADM.SET_UPDATE_CONFLICT_HANDLER@DBCS(
ERROR at line 12:
ORA-06550: line 12, column 2:
PLS-00306: wrong number or types of arguments in call to 'SET_UPDATE_CONFLICT_HA
NDLER'
ORA-06550: line 12, column 2:
PL/SQL: Statement ignored
However when I execute the same peice of code by logging on to the server the code executes successfully. "DBCS" is the database link name.
CODE which I am executing over DB LINK
DECLARE
COL_NAME DBMS_UTILITY.NAME_ARRAY;
CURSOR C1 IS
SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS WHERE OWNER='SCOTT' AND TABLE_NAME='DEPT';
BEGIN
OPEN C1;
FETCH C1 BULK COLLECT INTO COL_NAME;
CLOSE c1;
DBMS_APPLY_ADM.SET_UPDATE_CONFLICT_HANDLER@DBCS(
OBJECT_NAME => 'SCOTT.DEPT',
METHOD_NAME => 'OVERWRITE',
RESOLUTION_COLUMN => COL_NAME(1),
COLUMN_LIST => COL_NAME);
END;
CODE without DB LINK (executed this on db where db link is pointing too.
DECLARE
COL_NAME DBMS_UTILITY.NAME_ARRAY;
CURSOR C1 IS
SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS WHERE OWNER='SCOTT' AND TABLE_NAME='DEPT';
BEGIN
OPEN C1;
FETCH C1 BULK COLLECT INTO COL_NAME;
CLOSE c1;
DBMS_APPLY_ADM.SET_UPDATE_CONFLICT_HANDLER(
OBJECT_NAME => 'SCOTT.DEPT',
METHOD_NAME => 'OVERWRITE',
RESOLUTION_COLUMN => COL_NAME(1),
COLUMN_LIST => COL_NAME);
END;
Please guide.

orausern wrote:
Hi,
We are on Oracle 11.2.0.2 on Solaris 10. I have two databases on this version of Oracle. From one db I have execute a stored procedure via db link to another database. The store procedure has dynamic sqls (execute immediate) and it uses commit statement as part of the code. Is it alllowed to execute this procedure over db link? I am not aware on the implications on stored proc execution over db link and will be thankful for help.
Thanks,if no error is thrown, why are you looking for problems where none exist?

Similar Messages

  • Execute procedure over database link

    Hi,
    I''m working on a package where you can select the required database, paste some query and with clicking on a button it will execute and create an explain plan for this query.
    Therefore i've create a procedure on each database that put's the explain plan in the PLAN_TABLE.
    To do this i need to execute this prodecure from the package. I use the following code:
    DBA_OWNER.DB_PCD_EXPLAIN_PLAN@DBA_LINK_533.WORLD(p_query);
    This is working fine as this database link allready exists to the required database. But i want to make the database link name variable. I've allready created the dynamic database link:
    l_link varchar2(20) := 'DBA_LINK';
    l_link_nr number(4) := dbms_random.value(0,1000);
    l_db varchar2(20) := l_link||'_'||l_link_nr;
    l_statement varchar2(4000);
    begin
    l_statement := 'create database link '||l_db||' connect to **** identified by ***** using '''||p_database||'.WORLD''';
    execute immediate l_statement ;
    So now i have the dynamic databaselink that is created each time i call the package.
    now i want to use this databaselink to call the procedure. this is where it goes wrong.
    The code i'm using:
    DBA_OWNER.DB_PCD_EXPLAIN_PLAN@l_db(p_query);
    is not acceoted when i build the package.
    The follwoing error message is showed.
    PACKAGE BODY DBA_OWNER.PCK_EXPLAIN_PLAN
    On line: 66
    PLS-00352: Unable to access another database 'L_DB'
    Does someone know how to use this variable to execute the procedure on the remote db?

    Any procedures you call have to be accessible at compile time, so the database link must also exist at compile time.
    You can get around this by putting your procedure call to DB_PCD_EXPLAIN_PLAN inside dynamic SQL, the same as you are doing to create the database link. Dynamic SQL is not checked until runtime.
    Think about the risk if this procedure is exploited. You are creating a way for someone to run arbitrary code in an any database in your environment, with presumably a highly-privileged ID, if it can run an explain plan against any schema in any target database.
    This is exposing some significant security issues. Read up on SQL injection, and have someone else review the code for security issues before deploying this.

  • Error not getting while executing procedure via db link

    Hi,
    I am executing a database procedure remotely via database link from SQL prompt (SQL > EXECUTE REPLICATE_DATA@DBLK_SALE), and while getting any connectivity issue system is not giving any error (it is just showing as not responding)..
    if I am executing the same procedure directly in the remote database then it is giving error as
    ORA-02055: distributed update operation failed; rollback required
    ORA-02068: following severe error from DBLK_SALE
    ORA-03135: connection lost contact
    Can someone can help me on this
    Regards

    Dear 823755,
    You can think the Database link as a new sqlplus session to the distributed database. You should have defined a user to connect to that remote database and the user has to have the necessary privileges to revoke the relevant object. Does it have that privilege? Can you even connect to the remote database instance?
    SQL> SELECT * FROM DUAL@DBLK_SALE;Regards.
    Ogan

  • Remote call to a procedure over DB Link - Datatype mismatch

    Hi All,
    I've a procedure taking an array as input parameter. I invoked this procedure from other DB using a DB link but got DATATYPE mismatch error. I've given same name to the array type in both the DBs and used the same UID.
    Please help me out.
    Regards,
    MK
    CREATE OR REPLACE TYPE type_market_places IS table OF VARCHAR2 (100);
    CREATE OR REPLACE PROCEDURE racsf_populate_site (p_in_mrktplaces type_market_places)
    IS
       --lv_sql   VARCHAR2 (32000);
    BEGIN
    END;
    ------Invoking the procedure from the other DB using DB link
    DECLARE
      P_IN_MRKTPLACES type_market_places;
    BEGIN
      select col1 bulk collect into P_IN_MRKTPLACES;
      RACSF_POPULATE_SITE@DB_link ( P_IN_MRKTPLACES );
      COMMIT;
    END;

    You call DATA TYPE from DB_link datatype
    try this, please
    DECLARE
      P_IN_MRKTPLACES type_market_places@DB_link;
    BEGIN
      select col1 bulk collect into P_IN_MRKTPLACES;
      RACSF_POPULATE_SITE@DB_link ( P_IN_MRKTPLACES );
      COMMIT;
    END;

  • Procedure performance over db link

    In our source database, we are having one procedure that inserts data from one view and is inserting it into the another table.
    When we are running the procedure on this source system itself, it is getting executed in 3-4 mins
    Issue is coming when we are executing the procedure across database link.
    exec proc@source
    Plan is getting changed and is taking huge time. Are we hitting some bug or we have to stalablise the plan by addding hints is the only solution.
    Database version is 10.2.0.5
    Best Regards

    864411 wrote:
    In our source database, we are having one procedure that inserts data from one view and is inserting it into the another table.
    When we are running the procedure on this source system itself, it is getting executed in 3-4 mins
    Issue is coming when we are executing the procedure across database link.
    WHY across dblink?
    >
    >
    exec proc@source
    Plan is getting changed and is taking huge time. Doctor, it hurts when I poke myself in the eye.
    How can I get the pain to stop?
    So stop poking yourself in the eye!

  • Calling procedure over dblink - PLS-00306: wrong number or types of args

    Getting the above error when calling a procedure residing in a package on another database over a link.
    The arguments are an object and, a table of objects. The variables being passed are based on objects declared locally that look exactly like the ones the procedure is expecting.
    I haven't done this before so - I'm not sure what the issue is. The execute privilege has been granted on the dependent objects remotely as well as locally. I don't know what else to try and, I have not had any luck looking for a similiar issue online. Please help.

    Thanks but - before doing that I just wanted to see if someone can review this and see if this is my problem:
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96594/adobjbas.htm#466038
    We are using objects declared on the remote database. And, my variables I'm passing are of reference to exact copies on the host. But, from what I understand from the link above - you can't use object types across links. I'm completely lost as to whether this is the issue or not. It seems like a fairly obscure topic as far as documentation goes. If this is the issue however - what is the way around it? We are loading a table of objects with 40,000 plus rows of data to pass to a procedure remotely. If we can't pass the object type - how do we get the rows to the procedure (and, we aren't against modifying the remote procedure - just need to know the best method).
    Thanks in advance for your time - help.

  • Error in Executing Procedure through DBLink

    Hi,
    I am facing some problems in executing a procedure through DBLink.
    I have two schema A and B in two different database.
    In schema A I am having one procedure X in package Y and my requirement is that I want to execute this procedure in schema B. So in schema B i have created one DBLink ABC and trying to execute procedure X using this DB link.
    begin
    A.Y.X@ABC;
    end;
    But I am getting below error:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'A.Y.X@ABC' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    Any help would be greatly appreciated!
    Thanks In Advance..
    Regards,
    Sachin Bansal

    Hi,
    Yes, I am connecting to user A of DB1 and in this user I am having procedure X in Package Y. My DBLink in Schema B of DB2 is pointing to user A of DB1.
    I have created DBLINK using below script:
    create public database link abc
    connect to A
    identified by A
    using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX)(PORT=1521)))(CONNECT_DATA=(service_name=XXX)))';
    Above DBLInk is working fine..I am able to access all the table of schema A in schema B using this DBLink. But when I trying to execute any procedre of schema A in schema B then i am getting error.
    Regards,
    Sachin

  • Can we create pl/sql code over database link?

    Hi All,
    We are using Oracle 9i database.
    I want to know if we can create or modify pl/sql code (procedue, package, etc) over the database link? That means - can we create a procedure in remote database using the db link?
    Thanks,
    Dnyanesh

    yes, I can connect to the remote database directly and create/modify the packages.
    But I want the users not to create them using the db link.
    Is there any way to create the pl/sql package over database link?
    Thanks,
    Dnyanesh

  • Error Executing procedure

    We are comparing 3 tables T1,T2,T3.
    T2 is in remote server1
    T1,T3 are in server 2
    All are bound to the procedure by Db links.
    The Procedure is getting created .
    Only while executing the procedure the error is displayed.
    In case of T1,T2,T3 being present in a single server the proc is executing correctly.
    ERROR at line 1:
    ORA-02049: timeout: distributed transaction waiting for lock
    ORA-06512: at "NAGSPUDEVADM.HUGOTON_WELL_JOBSSW1", line 79
    ORA-06512: at line 1
    The first few lines of the procedure are:
    CREATE PROCEDURE nagspudevadm.hugoton_Well_Jobssw1 AS
    cur_apinumber1 varchar(200);
    cur_wellname1 varchar(200);
    cur_apinumber2 varchar(200);
    cur_wellname2 varchar(200);
    cur_apinumber3 varchar(200);
    cur_wellname3 varchar(200);
    CURSOR cur_T1 IS
    SELECT API_NUMBER,
    WELL_NAME
    FROM nagspudevadm.Well_Header_Table;
    CURSOR cur_T2 IS
    SELECT API_NUM ,
    WELL_NAME
    FROM ec_hugoton.documentum_v@DATAOPPB;
    CURSOR cur_T3 IS
    SELECT API_NUMBER,
    WELL_NAME
    FROM nagspudevadm.hugoton_master_table;

    After running the query,am getting a set of process but am not able to determine which of the process belongs to my procedure. Does the sql_text contain any information regarding the name of the procedure.
    Am posting the results as such
    SPID SID SERIAL# LOGON_TIM SQL_TEXT PID
    PROCESS
    8468 147 60517 26-JUN-08 ADDR and c.hash_value=a.sql_hash_value and a.STATUS='ACTIVE' 30
    6456:12016
    8468 147 60517 26-JUN-08 rocess from v$session a,v$process b,v$sqltext c where a.PADDR=b. 30
    6456:12016
    8468 147 60517 26-JUN-08 Select b.spid,a.sid,a.serial#, a.Logon_time,c.sql_text,b.PID,a.P 30
    6456:12016
    SPID SID SERIAL# LOGON_TIM SQL_TEXT PID
    PROCESS
    10884 137 3 18-JUN-08 BEGIN EMD_NOTIFICATION.QUEUE_READY(:1, :2, :3); END; 36
    1234

  • Calling Hana Store Procedure thorugh Eclipse link

    Hi,
    Anybody having idea of calling HANA store procedure through Eclipse Link JPA.
    Procedure has Scalar IN Parameter and Table Type as OUT Param:
    CREATE PROCEDURE tree_view (IN  topicid BIGINT,OUT qtree tt_tree)
        LANGUAGE SQLSCRIPT
        READS SQL DATA AS  
    BEGIN
    /// SQL Statements
    END;
    Currently i an calling the procedure as
    entiyManager.getTransaction().begin();
                java.sql.Connection connection = entiyManager.unwrap(java.sql.Connection.class);
                connection.setAutoCommit(false);
                CallableStatement cst = connection.prepareCall("call _SYS_BIC.\"workspace.procedures/tree_view\"(?,?)");
                cst.setLong(1, identifier);
                cst.execute();
                ResultSet rs =  cst.getResultSet();
         entiyManager.getTransaction().commit();
    But need more cleaned way like using StoreProcedureQuery or PLSQLStoredProcedureCall.

    Slightly missed the point.
    The question was about providing an INPUT variable.
    An in fact it is not possible to call a procedure with an table type input variable from the SQL console.
    You have to build a wrapper to call such a procedure:
    create type myusers as table (user_name nvarchar(60));
    create procedure count_users (IN user_tab myusers, OUT user_count bigint )
    language sqlscript
    as
    begin
        select count(*) into user_count from :user_tab;
    end;
    call count_users (? , ?)
    Could not execute 'call count_users (? , ?)' .
    SAP DBTech JDBC: [7]: feature not supported:
    Parameterized input table parameter is not allowed: line 1 col 19 (at pos 18)
    A wrapper for this could look like this:
    create procedure call_cu (out user_count bigint)
    language sqlscript
    as
    begin
        v_users = select user_name from users;
        call count_users (:v_users, :user_count);
    end;
    call call_cu (?)
    --> 28
    Unlike SQL*Plus for PL/SQL, the SQL console of SAP HANA is not a SQL Script runtime shell.
    - Lars

  • How to execute procedure in toad software

    hiii guy's i run my procedure on sql prompt and it run properly
    but when i tried this on toad i got an problem
    after compiling my procedure on toad
    when i write
    execute procedure_name(parameter1,parameter2);
    then i get an error i.e
    ORA-00900: invalid SQL statement
    can someone tell me how to execute procedure on toad
    thanks in adv...........

    how to execute procedure in toad softwareIn TOAD's schema browser you can go to the procedures tab - right click on the procedure in question and choose execute procedure - a window should pop up, where you can give optional parameters - the rest should be almost self explanatory ;)

  • How to execute procedure in SQL Worksheet ?

    Hi, anybody know, how I can execute procedure here?
    I try EXEC sec_roles, EXEC security_admin.sec_roles, EXECUTE - there is a SQL statement error. When I use CALL - there is no such procedure (I have execute previleges).
    Although in SQLPlus EXEC works, but there are problems with standard SQL commands (all of them returns "2" no matter what content is).
    Any ideas?
    Regards
    Krzysztof

    exec procedure(parameters) is a sql plus (and a few others) shortcut for
    BEGIN
       procedure(parameters);
    END;So try that then pressing/clicking whatever it is in sql worksheet that makes a statement run.
    Note that if your procedure has parameters defined as OUT or IN OUT, you will need to supply a variable to accept the returned value(s).
    John

  • Execute procedure error (Native SQL)

    Hi experts,
    I create a procedure
      EXEC SQL.
        create or replace procedure update_zsmadiprinc
        is begin
                              ( p_codigo         in  number(5),
                                p_ano            in  varchar2(4),
                                p_doc_vlr_princ in  varchar2(10)
                                p_subrc       out number ) is begin
          update T_INTERF_RESSARC_FORNEC_R3
          set   ano_doc              = p_ano,
                NUM_DOC_VALOR_PRINC  = p_doc_vlr_princ,
          where cod_interf_ressarc_fornec_r3 = p_codigo;
          if sql%found then
            p_subrc := 0;
          else
            p_subrc := 4;
          end if;
        end;
      ENDEXEC.
    and execute it
      EXEC SQL.
        execute procedure update_zsmadiprinc
                         (in  :wa-cod_interf,
                          in  :wa-ano_doc,
                          in  :wa-num_doc_valor_princ,
                          out :vg_subrc)
      ENDEXEC.
    But when i execute the procedure, shows dump error:
    Database error text........: "ORA-06550: line 1, column 7:#PLS-00905: object
    UPDATE_ZSMADIPRINC is invalid#ORA-06550: line 1, column 7:#PL/SQL:   
    Statement ignored#"                                                        
    Triggering SQL statement...: "CLOSE "                                       
    Internal call code.........: "[DBDS/NEW DSQL]"                              
    Please check the entries in the system log (Transaction SM21).              
    I comment all source, and the error is the same.
    When i create the procedure, no erros are show.
    I changed the name of the procedure, the type of parameters, and now i comment all and the error always is the same!!!! Can you help me!!! I need to finish this urgently!
    Thanks in advance
    Message was edited by:
            RP

    It is not possible to create a procedure, then, i just execute sql direct.
    thanks

  • Execute PROCEDURE in ORACLE

    I try to execute procedure on ORACLE(8i) but get err SQLException ..
    but for SELECT UPDATE INSERT statements all is OK!!
    for SELECT, UPDATE, INSERT I wrote such code:
    Statement stmt = conn.createStatement();
    String strExec="SELECT ...."
    stmt.executeQuery(strExec); (OR stmt.executeUpdate(strExec);)for proceure I wrote
    strExec = " my_proc() ";
    stmt.execute(strExec);what is wrong here??

    Try like this,
    CallableStatement cstm = con.prepareCall("{ call my_proc }");
    cstm.executeUpdate();
    Sudha

  • Interactive report performance problem over database link - Oracle Gateway

    Hello all;
    This is regarding a thread Interactive report performance problem over database link that was posted by Samo.
    The issue that I am facing is when I use Oracle function like (apex_item.check_box) the query slow down by 45 seconds.
    query like this: (due to sensitivity issue, I can not disclose real table name)
    SELECT apex_item.checkbox(1,b.col3)
    , a.col1
    , a.col2
    FROM table_one a
    , table_two b
    WHERE a.col3 = 12345
    AND a.col4 = 100
    AND b.col5 = a.col5
    table_one and table_two are remote tables (non-oracle) which are connected using Oracle Gateway.
    Now if I run above queries without apex_item.checkbox function the query return or response is less than a second but if I have apex_item.checkbox then the query run more than 30 seconds. I have resolved the issues by creating a collection but it’s not a good practice.
    I would like to get ideas from people how to resolve or speed-up the query?
    Any idea how to use sub-factoring for the above scenario? Or others method (creating view or materialized view are not an option).
    Thank you.
    Shaun S.

    Hi Shaun
    Okay, I have a million questions (could you tell me if both tables are from the same remote source, it looks like they're possibly not?), but let's just try some things first.
    By now you should understand the idea of what I termed 'sub-factoring' in a previous post. This is to do with using the WITH blah AS (SELECT... syntax. Now in most circumstances this 'materialises' the results of the inner select statement. This means that we 'get' the results then do something with them afterwards. It's a handy trick when dealing with remote sites as sometimes you want the remote database to do the work. The reason that I ask you to use the MATERIALIZE hint for testing is just to force this, in 99.99% of cases this can be removed later. Using the WITH statement is also handled differently to inline view like SELECT * FROM (SELECT... but the same result can be mimicked with a NO_MERGE hint.
    Looking at your case I would be interested to see what the explain plan and results would be for something like the following two statements (sorry - you're going have to check them, it's late!)
    WITH a AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_one),
    b AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_two),
    sourceqry AS
    (SELECT  b.col3 x
           , a.col1 y
           , a.col2 z
    FROM table_one a
        , table_two b
    WHERE a.col3 = 12345
    AND   a.col4 = 100
    AND   b.col5 = a.col5)
    SELECT apex_item.checkbox(1,x), y , z
    FROM sourceqry
    WITH a AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_one),
    b AS
    (SELECT /*+ MATERIALIZE */ *
    FROM table_two)
    SELECT  apex_item.checkbox(1,x), y , z
    FROM table_one a
        , table_two b
    WHERE a.col3 = 12345
    AND   a.col4 = 100
    AND   b.col5 = a.col5If the remote tables are at the same site, then you should have the same results. If they aren't you should get the same results but different to the original query.
    We aren't being told the real cardinality of the inners select here so the explain plan is distorted (this is normal for queries on remote and especially non-oracle sites). This hinders tuning normally but I don't think this is your problem at all. How many distinct values do you normally get of the column aliased 'x' and how many rows are normally returned in total? Also how are you testing response times, in APEX, SQL Developer, Toad SQLplus etc?
    Sorry for all the questions but it helps to answer the question, if I can.
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    Don't forget to mark replies helpful or correct ;)

Maybe you are looking for

  • How can I get the URL address of a secure https site to turn yellow

    The older versions of Firefox would turn the URL of a secure website yellow when accessed. Even with poor eyesight, I found this easy to see. When I upgraded to version 3.6, this feature was gone. Some of you programming capable users were kind enoug

  • Executable video file on iPod?

    I'm working with a marketing company and they want to do a big promotion with iPod. They want to load a video on 2,000 iPods and then hand them out. When recipient turns on iPod they want it to start playing. Anybody ever done this? THANKS!

  • Generic Withholding tax for Credit note

    I try to generic Withholding tax for credit note but It's show message No data was found. I check the selection criteria so many time and I use variant from another document that it can generic wht before.I just change posting date and document No. f

  • Scripting for PDF

    Hi, I am trying to create a basic JS script for an Acrobat X Pro created PDF, to have it on opening check the launching URL, and if not a specific, hard-coded URL in the script, to navigate to a URL redirect page (or alternatively, to close the PDF).

  • SAS 70 Security Audit Compliance

    Hi I have to propose a network which is in compliance with SAS 70 Audit. The network is very simple. Internet Link will terminate on my ASA 5505 and from there the wires will go into my 1200 APs.The network consists only of Laptops.I will be using 80