Call a procedure through a DB LINK ???

Hey,
I would like to execute a distant procedure in a process.
I have an HTML DB database with the "HTML DB application". I have a second db with my "data". With my "data" database I have a procedure, that I would like to execute in my HTMLDB database.
Is it possible (to call a procedure stored in a db which I access with a db link) ?
Thanks,
Fred

Yes. If you have schema DBA1 in database DATA1 with procedure PROC1 and HTML DB installed in database HTMLDB with the parsing schema HT then:
1) In schema HT create a database link named DBLINK which connects either to schema DBA1 or a schema in database DATA1 which execute privileges via a direct grant to run PROC1.
2) In schema HT invoke PROC1 by PROC1@DBLINK.
If you create a view named VW1 in schema HT like "SELECT * FROM TABLE1@DBLINK", then you can write INSERTs, UPDATEs, or DELETEs in HTML DB applications against view VW1 as if it were a table in database HTMLDB.
Mike

Similar Messages

  • Calling packaged procedure from a URL link

    I have created a custom APEX application the will allow us to dynamically build help screens for the pages we create with APEX.
    In doing this I have created a procedure within a package called "comi_help_util.show_help".
    This procedure uses the "htp.p" standard procedure to create a dynamic web page from data stored inside my help tables.
    I want to place a "Help" link in the Navigation Bar which will call the custom procedure, pass the APP_ID and APP_PAGE_ID and popup in a new window.
    I tried doing something like the Help link in APEX.
    javascript:popupURL('comi_help_util.show_help?p_application_id=&APP_ID.&p_page_id=&APP_PAGE_ID.');
    Unfortunately, I get "HTTP 404 - Web page cannot be found" error.
    I know I could probably call a page within my APEX application from my custom Help link which would then call my custom procedure.
    However, this means I would have to put a page within every application I want to use this on.
    I believe the call to the procedure directly would be cleaner and easier to implement, if I can get this working on my first app.
    I have never called a procedure thru a URL link or the javascript:popupURL and, try as I might, cannot search for the right keywords in the APEX forum or the Web.
    Any help would be appreciated.
    THANKS
    Raymond

    Hi Scott,
    >> Time for new glasses ...
    You are probably right, but regardless, I was referring to Raymond’s first post (and I should have made it clear). I noted that I believe your JavaScript statement is correct, I just can’t see the difference between it and the OP first statement, where, as far as I can see, he also used question mark (?) to mark parameters, and ampersand (&) to concatenate them. Still he received a 404 error. What am I missing there?
    Thanks,
    Arie.
    Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

  • Calling remote procedure through database link

    Hi,
    I have a procedure in a package with a type I delcared as follows:
    Database1 :
    create or replace package p1
    is
    TYPE dependents_rec IS RECORD (
    name VARCHAR2 (80),
    dob date);
    TYPE dependents IS TABLE OF dependents_rec
    INDEX BY BINARY_INTEGER;
    procedure proc1 (p_id in number,
    p_dependents out dependents );
    end;
    On another database database2 i want to call the above procedure from within a procedure in a package that works as a wrapper package with similar structure.
    I recieve the error "Wrong number or types of parameters" error because type dependents is not the same as within the package in database 1.
    How can I call the procedure p1.proc1 over a database link ?
    Thank you

    Hi,
    On database1:
    CREATE OR REPLACE PACKAGE types_pkg is
    TYPE dependents_rec IS RECORD (
    NAME VARCHAR2 (80),
    sex NUMBER (1),
    birth_date DATE,
    birth_place NUMBER (3),
    status NUMBER (1),
    unique_id VARCHAR2 (15)
    TYPE dependents IS TABLE OF dependents_rec
    INDEX BY BINARY_INTEGER;
    end;
    CREATE OR REPLACE PACKAGE wrapper_pkg_demo
    AS
    PROCEDURE read_person_no (
    p_person_id NUMBER,
    p_dependent_info OUT types_pkg.dependents
    END;
    CREATE OR REPLACE PACKAGE BODY wrapper_pkg_demo
    AS
    PROCEDURE read_person_no (
    p_person_id NUMBER,
    p_dependent_info OUT types_pkg.dependents
    IS
    BEGIN
    person_pkg.read_person_no (p_person_id, p_dependent_info);
    END;
    END;
    On database 2:
    CREATE OR REPLACE PACKAGE person_pkg
    AS
    PROCEDURE read_person_no (
    p_person_id NUMBER,
    p_dependent_info OUT types_pkg.dependents@database1
    END;
    CREATE OR REPLACE PACKAGE body person_pkg
    AS
    PROCEDURE read_person_no (
    p_person_id NUMBER,
    p_dependent_info OUT types_pkg..dependents@database1
    IS
    BEGIN
    null;
    END;
    END;
    When compiling the package body on database 1
    ORA-04052: error occurred when looking up remote object TYPES@MOI
    ORA-00604: error occurred at recursive SQL level 1
    ORA-02019: connection description for remote database not found
    Noting that the database link are working properly and when compiling the package on database 2, it compile successfully
    Thank you

  • Calling Stored Procedures through JDBC

    Hello!
    I would like to implement a call to a stored procedure through JDBC. This call I suppose to embed in JavaBean to import Bean as model.
      A) Shoud this call be implemented inside ordinaly JavaBean or inside EJB?
      B) How can I determine DataSource? Is it possible through JNDI?
      C) Is there any tutorials or examples?
      D) Could anybody give some code texts on this theme?

    we use quite a similar architecture here (2 ORACLE DBs, a DB link from one instance to the other). However, we use the db links in functions (not in stored procedures). but a simple select using the db link also works with JDBC. do you use the very same db instances / schemas / users+passwords on all your different test environments? so far, we havent' noticed any problems with ORACLE queries (stored procedures, functions, etc.) that work in sqlplus/worksheet but not with JDBC. do you use the latest ORACLE JDBC drivers (9.2.0.3)?

  • Problem in calling stored Procedure through Toplink

    Hi ,
    I'm doing POC of calling stored thru toplink but facing some issues. Any pointers to it would be helpful.
    This is my javaCode used to call stored proc through toplink:-
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("testdeleteLeafBox");
    call.addNamedInOutputArgumentValue(
    "box_id", // procedure parameter name
    new Integer("1455"), // in argument value
    "box_id", // out argument field name
    Integer.class // Java type corresponding to type returned by procedure
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    Integer metricLength = (Integer) session.executeQuery(query);
    My Stored Procedure is :-
    create or replace procedure testdeleteLeafBox(
    v_box_id IN NUMBER ,
    result OUT number
    is
    v_result number;
    BEGIN
    SELECT client_id INTO v_result FROM tb_gvhr_box WHERE box_id=v_box_id;
    result:=v_result;
    end testdeleteLeafBox;
    Thrown exception is :-
    [TopLink Warning]: 2006.02.24 06:35:47.077--DatabaseSessionImpl(650)--Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'TESTDELETELEAFBOX'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call:BEGIN testdeleteLeafBox(box_id=>?); END;
         bind => [1455 => box_id]
    Query:ValueReadQuery()
    Exception breakpoint occurred at line 1927 of Session.java.
    oracle.toplink.exceptions.DatabaseException: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'TESTDELETELEAFBOX'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    The stored procedure defined in the db has one IN and one OUT parameter, therefore in StoredProcedureCall you'll need to have one IN one OUT parameter as well (instead of a single INOUT):
        call.addNamedArgumentValue(
            "v_box_id", //procedure IN parameter name
            new Integer("1455"));
        call.addNamedOutputArgument(
            "result",  //procedure OUT parameter name
            "box_id", // out argument field name
            Integer.class // OUT parameter Java type);

  • Calling a procedure from a dynamic link

    I have the following situation-
    I have a report created using SQL Query.
    I need to call a Stored Procedure(move_to_portal) through a link from one of the fields in the report (Exec_id field of the report).
    How can I do this?
    The links do not allow me to choose a stored procedure as the Target component....so maybe I have to create a dynamic link.
    How to do this? Any help would be appreciated.

    I have just another question-
    I have a procedure testing_del_archive which is being called with 2 parameters...from a dynamic link in my SQL Query.
    The following is my code....
    SELECT re.report_exec_id, re.exec_userid,
    NVL(re.batch_exec_date, re.begin_date) report_date,
    re.rows_returned,
    re.status, re.error,
    f_file_url(re.filename) file_url,
    re.comments,
    ''Archive''archive
    FROM metadev.report_execution re, metadev.report r
    WHERE re.report_id = r.report_id
    AND r.spec_number = :v_spec
    AND re.status <> 'DELETED'
    AND re.exec_userid like (DECODE(:v_user_filter,'ALL','%',:v_user_filter))
    ORDER BY begin_date DESC
    The first parameter is the value in the execution id field and the second argument is hardcoded "Archived"...
    IT GIVES AN ERROR....
    Do you guys know where I am going wrong...

  • Problem when call store procedure over a database link

    Hi all,
    I've create a database link in server "EAST" similar like:
    CREATE DATABASE LINK db_link CONNECT TO tiger IDENTIFIED BY scott USING 'abc';
    and from server "EAST" i ran the procedure located in server "WEST" somethin like:
    exec testing_procedure@db_link('test');
    testing_procedure is look like:
    Create or Replace procedure testing_procedure (p_testing in varchar2)
    as
    cursor check_space is
    select sum(bytes)/1024/1204 tb_size
    from dba_data_files;
    my_check_space%ROWTYPE;
    begin
    open check_space;
    loop
    fetch check_space into my_check_space;
    exit when check_space%NOTFOUND;
    insert into test_tf@db_link (test, tb_value) values
    (p_testing, my_check_space.tb_size);
    end loop;;
    close check_space;
    end;
    and my problem is when i'm run procedure from "EAST" server, the values in test_tf table is the same as when you run that procedure from "WEST" server. I've check the size for both server "EAST", and "WEST" by select sum(bytes)/1024/1204 command. And the value is completely different. And i guest somehow it reuse the value of "WEST" server no matter when you run that procedure in "EAST" server. Any suggesttion, please give me some advices.
    Thanks,
    Kevin

    If this procedure is in WEST server then even if you call it from some another planet using db link, the cursor inside the procedure will fetch the data from that server only means WEST server. So "select sum(bytes)/1024/1204 tb_size
    from dba_data_files;" statement in your procedure always fetch the size of the datafiles belongs to the WEST database.
    If you want to store the data of two different databases then you have to create the similar procedure in EAST database also.
    BTW, you said the you created a database link "db_link" in EAST database to point to WEST database and on WEST database you have that procedure BUT I don't understand why r u using "db_link" in your procdure code in WEST server in this insert statement:
    insert into test_tf@db_link (test, tb_value) values
    (p_testing, my_check_space.tb_size);Is there a database link on that box also?? Where it is pointing to?? And if not then this code should not be compiled.
    Daljit Singh

  • Calling a procedure from a portel report

    I have a report which is returning rows from a dblink, this works fine. I want to select an individual row from the report and write a new record to a diffent table using some of the columns from the row selected. The table I am writting to will be held within the portal db.
    Idea...
    Is it possible to call a procedure using the link application wizard (html link), if I could call a procedure via the html link and pass parameters from the record selected then I could write some pl/sql to insert a row in my other table, is this possible ?,if so how do I do it ?
    Any other ideas would be most welcome.
    Thanks in anticiptaion.

    The javascript function - you copied it completely, including all my beautiful images - calls an Application Process : toggleAvail.
    And I guess you didn't define that one.
    You created a stored procedure instead (with another name?), but with an AJAX call you can (only) call Application Processes....(which can call stored procedures...).
    (Je mag me ook direct mailen/bellen als dat sneller is...).
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Calling Stored Procedure with CLOB parameter

    Hi,
    i have one procedure with IN parameter CLOB which is taking xml file and stored in one table column and this table column datatype is also CLOB. And this procedure called by .Net program but problem is when the file will come more than 32KB calling procedure failed. But as i know CLOB can stored up to 4GB data.
    Is that Limitation of oracle or .Net version
    please let me know the solution for that,
    Create Procedure Insert_File(P_XMLFILE IN CLOB)
    as
    begin
    insert into instances
    values(p_xmlfile);
    commit;
    end;
    regards,
    Madan

    Hi Thanks for your reply,
    Actually this procedure called by .net program and the XML file has passed in that parameter which come from some FTP(its inbound) and this files we are storing into above mentioned table.
    Error has come while calling stored procedure Through .net
    Error Details:
    Error calling stored procedure. 0 retry attemps has failed. Error: System.Exception: Error while calling stored procedure on Oracle: INSERT_FILE: System.Data.OracleClient.OracleException: ORA-01460: unimplemented or unreasonable conversion requested

  • How to call a Procedure throguh a BUTTON

    I want to call a procedure through a button; WHEN BUTTON PRESSED TRIGGER.
    Plz tell how it would be...?

    Ghulam Yassen wrote:
    I want to call a procedure through a button; WHEN BUTTON PRESSED TRIGGER.
    Plz tell how it would be...?Without more information, it's hard to provide exact solution...
    just call a procedure in a button or anywhere simply follow this code
    procedure_name;Hope this helps

  • Web Service calling a Stored Procedure thru a DB Link

    hi guys,
    I'm getting this error ORA-02064: distributed operation not supported when I invoke my Web service. My scenario is more like the #3 below. How can I simplify update when what I'm invoking is just inserting a record in a table.
    - USER A calls, a procedure owned by USER B (w/c inserts to table X)
    - USER A have insert, update rights to TABLE X owned by USER B
    - USER A have execute rights to the procedure owned by USER B
    - USER A does the calling by Callable statement
    e.g. begin B.runme@dblink(?,?); end;
    - USER B is an Oracle ERP SCHEMA user, USER A is just another oracle schema but not of any Oracle apps
    - USER B runme Procedure have a COMMIT statement inside and an OUT parameter.
    I have no problems in making this code run when procedure being called is not thru dblink.
    I'm really have no other idea how to fix this. except for using a different user maybe B or C that logs to the same DB without using any other DB link.
    I'm guessng, maybe Web Service does not allow such call which uses a DB link.
    Help anyone?
    below is the ORA explanation.
    ORA-02064: distributed operation not supported
    Cause: One of the following unsupported operations was attempted:
    1. array execute of a remote update with a subquery that references a dblink, or
    2. an update of a long column with bind variable and an update of a second column with a subquery that both references a dblink and a bind variable, or
    3. a commit is issued in a coordinated session from an RPC procedure call with OUT parameters or function call.
    Action: simplify remote update statement

    You can check this example.

  • Calling a procedure from an OAF page through a button in the screen

    problem: calling a procedure from an OAF page through a button in the screen

    CREATE OR REPLACE procedure APPS.xx_delete_dept_prc(p_id in number)
    as
    begin
    delete from xx_training_dept_tbl where td_dept_id=p_id;
    commit;
    end;
    2.     create image button for delete
    3.     set the following property to this button:
    action type : fire action
    event :DeleteDept
    parameter :
    name: DEptIdParam value: ${oa.XxTrainingDeptVO1.TdDeptId}
    4.     create Co and writing the following code on process form request
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    String actionInscreen=pageContext.getParameter(EVENT_PARAM);
    if ("deleteDept".equals(actionInscreen))
    String deptidparam=pageContext.getParameter("DeptIdParam");
    Serializable [] s={deptidparam};
    Class [] c={deptidparam.getClass()};
    OAApplicationModule am=pageContext.getApplicationModule(webBean);
    am.invokeMethod("deleteDept",s,c);
    throw new OAException("delete completed",OAException.INFORMATION);
    5.     create AM and writing the following code
    public void deleteDept(String deptid) {
    XxTrainingDeptVOImpl deptview= getXxTrainingDeptVO1();
    deptview.deleteDept(deptid); }
    6.create VO and writing the following code in view object class
    public void deleteDept(String deptid
    System.out.println("Dept ID =" +deptid);
    String s = "call xx_delete_dept_prc(:1)"; // :1 is the number of parameter to pass it to procedure
    CallableStatement cs =trx.createCallableStatement(s,1); // 1 number of record to fetch but delete always delete 1 row
    try
    cs.setString(1,deptid); // the name of the first parameter
    cs.execute();
    cs.close();
    catch (SQLException e)
    e.printStackTrace();
    }

  • How it works (Calling Stored Procedure in DB2 Through Callable statement)

    Can anyone Please tell me what exactly happens on calling ESP(External Stored Procedure) through Callable statement Database point of view and Callable point of view also.
    eg:
    CallableStatement cstmt = con.prepareCall(
    "{call getTestData(?, ?)}");
    cstmt .executeUpdate();
    where getTestData is Stored Procedure in DB2.
    Can anyone please guide me working on this scenario..
    Message was edited by:
    Nitin_Gupta

    Check this post out:
    http://forum.java.sun.com/thread.jspa?threadID=638768&messageID=3785982
    But I think you should be getting results right? What do you mean you want it in a format other than resultset?

  • Calling Oracle Stored Procedure through COBOL

    I am calling a Oracle Stored Procedure through COBOL program. Here is the procedure that is in Oracle.
    PROCEDURE sp_sel_m_event_subs_profile (
    eventID IN EventIDTyp,
    subscribed IN NUMBER,
    v_profileRef OUT profileRefWithDSID_cv
    IS
    BEGIN
    sp_check_event_id(eventID);
    OPEN v_profileRef FOR
    SELECT
    sub.profile_i,
    ref.datasource_i,
    ref.primary_key_x
    FROM
    ccf_event_subscribe sub,
    ccf_profile_reference ref
    WHERE
    sub.event_i = eventID
    AND
    sub.is_subscribed_i = subscribed
    AND
    sub.profile_i = ref.profile_i;
    END sp_sel_m_event_subs_profile ;
    So while trying to call this procedure in COBOL program I am getting error as wrong number or types of arguments in call to 'SP_SEL_M_EVENT_SUBS_PROFILE'
    Here is the call statement in COBOL. I tried with many other options by adding some more fields but did not work.
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    (:EVENT-I, :SUBSCRIBED);
    END;
    END-EXEC
    Please someone let me know how should I pass arguments EVENT-I and SUBSCRIBED to this Procedure so that I will get PROFILE-I, DATASOURCE-I and PRIMARY-KEY-X
    Note: The above procedure is working good by other software. But there is no example as How to use Call statement through COBOL.
    Thanks

    Here is the cobol declaration of each variable.
    01 EVENT-I PIC X(06) VALUE SPACES.
    01 SUBSCRIBED PIC 9(01) VALUE ZEROS.
    01 PROFILE-I PIC X(08) VALUE SPACES.
    01 DATA-SRC-I PIC X(08) VALUE SPACES.
    01 PRIMARY-KEY-X PIC X(08) VALUE SPACES.
    I tried with this layout, but still not working
    01 EVENT-I PIC 9(06) VALUE ZEROS.
    01 SUBSCRIBED PIC 9(01) VALUE ZEROS.
    01 PROFILE-I PIC 9(08) VALUE ZEROS.
    01 DATA-SRC-I PIC 9(08) VALUE ZEROS.
    01 PRIMARY-KEY-X PIC 9(08) VALUE ZEROS.
    Here are some of them I tried.
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    ( :EVENT-I
    , :SUBSCRIBED
    , :PROFILE-I);
    END;
    END-EXEC
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    ( :EVENT-I
    , :SUBSCRIBED
    , :PROFILE-I
    , :DATA-SRC-I
    , :PRIMARY-KEY-X);
    END;
    END-EXEC
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    ( :EVENT-I
    , :SUBSCRIBED );
    END;
    END-EXEC
    EXEC SQL EXECUTE
    BEGIN
    TWSUSER_OWN.PKG_CCF.SP_SEL_M_EVENT_SUBS_PROFILE
    ( :PROFILE-I
    , :DATA-SRC-I
    , :PRIMARY-KEY-X);
    END;
    END-EXEC

  • Calling Remote Procedure using DB Link

    In Oracle v8 or earlier DB link can be used only to Insert/Update/Delete Or Select Data with the Remote DB. But, Oracle 8i, allows us to call A procedure stored in a remote DB. I have oracle8i server and not sure about the other Oracle svr version (Could be 7.3 under unix/8 under unix or so).
    Is it possible to call a procedure stored in a remote DB(different version)from oracle 8i?
    null

    GUNN3R wrote:
    I have a package in a database defined this way:
    CREATE OR REPLACE PACKAGE BODY xx_dummy_package
    IS
    FUNCTION dummy_procedure RETURN NUMBER
    IS
    BEGIN
    DBMS_OUTPUT.PUT_LINE('I am now in dummy_procedure');
    RETURN 1;
    END dummy_procedure;
    END xx_dummy_package;
    And I'm trying to call this package from an external database using the next code:
    DECLARE
    num NUMBER;
    BEGIN
    -- user package db link function
    num := [email protected]_PROCEDURE();
    END;
    But I'm getting the next error:
    ORA-06550: line 7, column 12:
    PLS-00352: Unable to access another database 'APPSRHREM.XX_DUMMY_PACKAGE.DUMMY_PROCEDURE'
    ORA-06550: line 7, column 12:
    PLS-00201: identifier '[email protected]_DUMMY_PACKAGE.DUMMY_PROCEDURE' must be declared
    ORA-06550: line 7, column 5:
    PL/SQL: Statement ignored
    Anyone knows why is this happening?
    Thanks :)incorrect syntax

Maybe you are looking for

  • Not able to query the price of PTO model through Pricing and availability

    Hi all, I book an order for PTO model through OM, i get the prices displayed, if i query the same model through Pricing and availability form, to know the price, there is no item found in the LOV The same model in istore, shows no prices in the catal

  • Mac illustrator CS5 Cmd-Shift- not working

    I used this a lot to quickly change type size in earlier versions (up to CS4). The back arrow ( < ) works fine to reduce size but the > won't increase the size. I just trashed the prefs and restarted AI and it still doesn't work. Any ideas. David

  • DAQ Assistant to typedef data cluster

    Hi All, I was hoping someone could be able to shed some light on an issue I have been pulling my hair on for a week now.  I am recently new to LabView (less than 6 months), and up until I have been able to locate/research any issues I had ran into. 

  • Very Strange iTunes Error

    Hello everyone? This is my first post- glad to be amongst some knowledgeable people who might be able to help me! So everything is working fine on my computer- no issues at all. Then one day I go to open iTunes, and every time I do now, I get a "Not

  • Podcasts not synch'ing.

    Has anyone come across this problem before? Basically I have a few podcasts with many episodes that are downloaded via iTunes and I generally keep them forever. For a couple of them a number of episodes will not synch to the ipod. I am running iTunes