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

Similar Messages

  • Problem of retrieve a set of data when calling store procedure using vb with ODBC

    when I use ODBC, it can return 1 record (1 field) using pass and retrieve the parameter. but it cannot success when return a set of data (using recordset to store it), when i do it, the error message (Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if availabl. No work was done.). Why ? and how can solve it ?\
    Thanks in advance.

    oh, really ? it is not use ODBC to connecto to oracle ?
    Here is my program code:
    STORE PROCEDURE:
    PROCEDURE getInforcePolicy(PClient_ID IN VARCHAR2, PPolicy_No IN VARCHAR2, BasicCur OUT oraoledb.m_refcur, RiderCur OUT oraoledb.m_refcur)
    IS
    BEGIN
    OPEN BasicCur FOR SELECT * FROM
    inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No = 1;
    OPEN RiderCur FOR SELECT * FROM
    inforce200111 WHERE Client_ID = PClient_ID and Policy_No = PPolicy_No and coverage_No <> 1;
    END getInforcePolicy;
    PACKAGE oraoledb AS
    TYPE m_refcur IS REF CURSOR;
    END oraoledb;
    Program:
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim rs2 As New ADODB.Recordset
    Dim cmd As New ADODB.Command
    Dim paramclient As New ADODB.Parameter
    Dim parampolicy As New ADODB.Parameter
    Dim I As Integer
    cn.Open "ridev", "abc","abc"
    cmd.ActiveConnection = cn
    Set paramclient = cmd.CreateParameter("PClient", adVarChar, adParamInput, 10)
    Set parampolicy = cmd.CreateParameter("PPolicy", adVarChar, adParamInput, 10)
    paramclient.Value = "0000023011"
    parampolicy.Value = "HK0010021U"
    cmd.Parameters.Append paramclient
    cmd.Parameters.Append parampolicy
    cmd.CommandText = "{call getInforcePolicy}"
    Set rs = cmd.Execute
    Do While Not rs.EOF
    Loop
    Set rs2 = rs.NextRecordset
    Do While Not rs2.EOF
    loop
    Where the RIDEV is a datasource that created from Data Source in Control Panel using the driver call "Microsoft ODBC for ORACLE"

  • About JDBC CALL STORE PROCEDURE with out parameter is greater than 4000

    Hi Guys,
    I have a problem call store procedure with a large string.
    as i know varchar2 can contain 32767 characters in pl/sql .
    But when i used varchar2 as a out parameter in a store procedure, if the out parameter is greater than 4000 characters , it always give me error message as 'the buffer is too small'.
    why it happened?
    I read some article that says i need configure a property in data-source.xml , and jdbc 10g driver already solved this problem, but i used jdev 10.1.3.2 ,the driver should be fine.
    How can i solve this problem?
    Thanks in advance,
    AppCat

    Object is Foundation, Execute Script
    This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    import java.sql.*;
    PreparedStatement stmt = null;
    Connection conn = null;
    ResultSet rs = null;
    try {
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
    conn = ds.getConnection();
    stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
    stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
    rs = stmt.executeQuery();
    rs.next();
    patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
    } finally {
    try {
    rs.close();
    } catch (Exception rse) {}
    try {
    stmt.close();
    } catch (Exception sse) {}
    try {
    conn.close();
    } catch (Exception cse) {}

  • Array data sporadically lost when calling stored procedure

    We have weird problem with stored procedures for which I have not been able to find an explanation so far.
    Our app has a bunch of stored procedures which process arrays of integers or strings.
    From time to time (maybe 1 in a 1000) array data gets lost when calling stored procedures. From the logs we know that the data gets sent to the stored procedure, but on the DB side the procedure throws an exception because arrays are empty.
    We are using (modified) OracleConnectionCacheImp (thus PooledConnections, etc.). My latest guess is that maybe somehow ArrayDescriptors on the (pooled)connection used to call the stored procedure are somehow affected when another pooled connection from OracleConnectionCacheImp gets removed by parallel thread. Is that possible? Or are the PooledConnections internally (in pooled connection data source) completely isolated from each other ?

    We have weird problem with stored procedures for which I have not been able to find an explanation so far.
    Our app has a bunch of stored procedures which process arrays of integers or strings.
    From time to time (maybe 1 in a 1000) array data gets lost when calling stored procedures. From the logs we know that the data gets sent to the stored procedure, but on the DB side the procedure throws an exception because arrays are empty.
    We are using (modified) OracleConnectionCacheImp (thus PooledConnections, etc.). My latest guess is that maybe somehow ArrayDescriptors on the (pooled)connection used to call the stored procedure are somehow affected when another pooled connection from OracleConnectionCacheImp gets removed by parallel thread. Is that possible? Or are the PooledConnections internally (in pooled connection data source) completely isolated from each other ?

  • ADF 11, USING EJB, CALL STORE PROCEDURE, A PROBLEAM?

    ADF 11, USING EJB, CALL STORE PROCEDURE, A PROBLEAM?
    I have a store procedure:
    CREATE OR REPLACE PACKAGE BODY PK_HR1
    IS
    FUNCTION FUNC04
    RETURN CUR_RESULT
    IS
    X_CUR CUR_RESULT;
    BEGIN
    OPEN X_CUR FOR
    select mako, tenko, diachiko from kho;
    RETURN X_CUR;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END FUNC04;
    END PK_HR1;
    In the entities class, I have a NamedStoredProcedureQuery:
    @Entity
    @NamedStoredProcedureQuery(name="Kho.FUNC04",
              resultClass=Kho.class,
              procedureName="PK_HR1.FUNC04" )
    public class Kho implements Serializable {
    In session bean, i have a method
    public class SessionEJBBean implements SessionEJB, SessionEJBLocal
    public void test() throws Exception{
    try {
    //code here ...
    List<Kho> listKho = em.createNamedQuery("Kho.FUNC04").getResultList();
    System.out.println("aaaa");
    } catch (Exception ex) {
    ex.printStackTrace();
    } finally {
    I try running, but always show errror
    this errors:
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00221: 'FUNC04' is not a procedure or is undefined
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    Call: BEGIN PK_HR1.FUNC04(); END;
    Query: ReadAllQuery(jp.co.mfr.sgs.bean.Kho)
    help help me?

    You need to use a CallableStatement for this.
    --olaf                                                                                                                                                                                                           

  • To call Store procedure

    I log in in the Enterprise manager with the user "Nadia" that I created . I Created an escheme TEST and all the tables .
    I Created also the package with this user. It has a procedure that returns 1 cursor.
    This user has:
    atributte: CONNECT, DBA AND RESOUCE
    System: EXECUTE ANY PROCEDURE AND UNLIMITED TABLESPACE
    Is it correct?
    My application is access the oracle 9i with this user too.
    I have to call the procedure this way:
    SID.PACKAGE.PROCEDURE
    Im my vb code, I am call this way too.
    Code VB 6:
    With cmd
    .ActiveConnection = CNP
    .CommandText = "NADIA.EXT_DADOS.DADOS_VISITANTE" ????
    .Prepared = False
    .CommandType = adCmdStoredProc
    .Parameters.Append .CreateParameter("@Documento", adInteger, adParamInput, 15, 8384474)
    .Parameters.Append .CreateParameter("@nome", adChar, adParamInput, 1, lsTipo)
    Set ObReg = .Execute(, , adAsyncFetchNonBlocking)
    End With
    When execute, message errors show:
    The NADIA.EXT_DADOS.DADOS_VISITANTE needs to be declared.
    Wha is wrong?
    thank you
    Nádia

    It looks like you are getting appropriate feedback in one of the other threads on this topic that you've posted:
    To call Store procedure
    But I would have to say that I hope this is just a test system. I would never grant DBA, EXECUTE ANY PROCEDURE, and UNLIMITED TABLESPACE to a "normal" user in a production system.
    Good luck,
    Mark

  • ORA-28868 error when calling Web service over HTTPS from PL/SQL utl_http

    I am getting error message ORA-28868 error when calling Web service over HTTPS from PL/SQL utl_http PL/SQL package,
    when browsed through some of the messages they point to setting Oracle Wallet Manager.
    I am trying to connect
    Any idea on how to resolve this issue ?
    your input is appreciated.
    Thanks
    Ravi

    Duplicate post ... please ignore.

  • How to call store procedure in query generator

    Hi All,
    How to call store procedure in query generator.
    Regards
    Rajkumar Gupta
    Edited by: Rajkumar Gupta on Dec 7, 2010 2:11 AM

    Hi,
    Please check the following threads.
    How to use Stored Procedure in sap business one
    How to add parameters to a stored procedure in B1 Query generator
    How to execute the procedure in sap b1
    Hope it helps,
    Vasu Natari.

  • Help: How to open wrapped store procedure on oracle database

    Dear Gurus,
    how to open the wrapped store procedure on oracle database?
    anyone can help me...?
    reply me soon
    take care

    Any other way so that I can see the flow of data that written on wrapped store procedure?You need to see the source code which has keeped outside of database. Read a wrapped code is not common for humans...
    reply me asap If you want an asap answer, raise a SR for oracle support, not through a forum which is based on volunteers.
    Nicolas.

  • 11g preview version 3: JNDI Lookup problem when calling PL/SQL webservice

    Hi,
    I am experiencing a problem when calling a PL/SQL Webservice from a BPEL flow.
    When I am trying to test my BPEL flow from the SOA Console I get a "Error doing JNDI lookup on target jdbc/MyDBDS"
    The composite application including the BPEL flow is deployed in one application. "CompositeApp" and the web service in another Application called
    "WebServiceApp".
    Both applications are deployed on the same built in OC4J Application Server
    If I test the webservice in isolation from the SOA console it works. It also seems to be working if the webservice and the and the BPEL flow is in the same project.
    If anyone has any ideas on this one I would be very greatful.
    Thanks in advance

    try creating the MyDBDS connection as an application resource in both applications.

  • [svn] 4741: Fix to RTE problem when calling captureEndValues() without having first called captureStartValues().

    Revision: 4741
    Author: [email protected]
    Date: 2009-01-29 13:43:53 -0800 (Thu, 29 Jan 2009)
    Log Message:
    Fix to RTE problem when calling captureEndValues() without having first called captureStartValues(). outcome of a patch submission, although this fix is different than the one suggested in the patch.
    QE Notes: None
    Doc Notes: None
    Bugs: patch sdk-17060, bug sdk-16452
    Reviewer: Jason
    tests: checkintests, Mustella: tests/Effects tests/ListDataEffects
    Ticket Links:
    http://bugs.adobe.com/jira/browse/sdk-17060
    http://bugs.adobe.com/jira/browse/sdk-16452
    Modified Paths:
    flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/effects/Effect.as

    Look for the "contact us" on the verizon pages.  http://www22.verizon.com/content/contactus/
    Almost all of the forums here are peer to peer.  Some verizon admins will occasionaly step in and try to get you help.  These admins are usually not able to solve problems for you themselves, but can sometimes give advise or get you in contact with someone who can.

  • Wb_rt_api_exec over a database link

    When I call wb_rt_api_exec over a database link I receive:
    ORA-20001: Task not found - Please check the Task Type, Name and Location are correct.
    ORA-06512: at "OWB_10_2_0_1_31.WB_RT_API_EXEC", line 704.
    When I run the command on the other database it works.
    Is there a way to do this?
    Thanks,
    Joe

    We had the same error when starting a package with WB_RT_API_EXEC.RUN_TASK from JBoss Middleware. It ran fine when started directly from SQLDeveloper, but threw the error when started from JBoss. Adding the pragma solved the problem, we also had to put a commt; at the end of the procedure.

  • ORACLE 11g + PHP5 problem: "fetch out of sequence" on remote database link

    Hi!
    I have a new server with oracle 11g (11.1.0.7) database and apache/php5 (actual build) on linux.
    connection type is dedicated.
    when doing a connection to a remote AS/400 database I always get this error:
    "Warning: oci_fetch_array() http://function.oci-fetch-array: ORA-01002: fetch out of sequence ORA-02063: preceding line from..."
    when doing the same simple "select * from database link" at my old server with oracle 9i and apache/php5 no problem occurrs.
    this happens at AS/400 database link only. normal oracle database links work fine.
    Anyone an idea how to solve this problem or where the problem is????
    further info:
    when doing " select * from [ database link ] where rownum < 11 " it works, but when doing the query with more than 10 results I get the error. Any idea?
    bye,
    Oliver
    Edited by: user501548 on 10.10.2008 02:20

    well a fetch out of sequence usually indicates that a cursor has been closed before the process has finished fetching or some such thing.
    I'm not aware of there being a specific problem with the situation you outline, but maybe if you could provide all the connection setup and how you are trying to connect that may give a better idea.
    Also, you may be better asking on the General Database Discussions forum as this isn't really a SQL or PL/SQL problem

  • 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.

  • Timeout not working when calling stored procedure

    Hi,
    We have a Win32 application connected to ORACLE using ODBC API.
    A stored procedure (doing INSERT into 3 tables) is called via
    SQLPrepare and SQLExecute("{CALL SP(IN param...) ...}"), but
    Oracle never time out the statement.
    There are 2 types of modified timeouts:
    SQL_ATTR_QUERY_TIMEOUT = 20
    SQL_ATTR_CONNECTION_TIMEOUT = 60
    Even if I set LockTimeOut parameter in ORAODBC.ini file, it
    still doesn't work.
    I tried with SQLExecDirect("INSERT...") and it works fine.
    - Does time out works with oracle Stored Procedure ?
    - If not, how can I avoid application hangs when calling
    SQLExecute ?
    - I use "lock table MY_TABLE in exclusive mode" to simulate
    query timing out. Is the better way to do this ?
    Please, any help would be GREATLY appreciated :-)
    Thanks.
    -Dario Efine
    [email protected]
    Infos:
    - Application running on WinNT4 SP6a,
    - Oracle ODBC for Oracle 8.01.76.00,
    - Stored procedure has 10 IN parameters, it also uses 2 inner
    small functions.

    HiTopp wrote:
    I get a "Login Failed for user _____" error if I attempt to use incorrect credentials.
    That message is very likely coming from the database. To be sure, turn debugging on in the ColdFusion Administrator. Also check out the logs. We have to narrow this down, otherwise we could end up running circles.
    If the attribute pairs [username="valid_name", password="valid_password"] and [username="", password=""] work, but [username="valid_name", password="invalid_password"] fails, then the cause of the problem is most probably your code, and how it connects to the database(s). Could you show us all (or at least more) of the code?
    My first suggestion to you was to omit the line variables.storedProcService.clear();. Invoking clear() only makes sense when it occurs after addProcResults() or addParam(). Did you omit the line? What was the effect, with and without credentials?
    Could you please describe your infrastructure a bit more. From what I understand, there are at least 2 servers, S1 and S2. Let's say, ColdFusion is installed on S1. I am assuming from what has gone before that SQL Server, which runs the stored procedure, is on the second server S2.
    Go to the 'Client Variables' page in the ColdFusion Administrator. Verify that ColdFusion is indeed configured to use a database for client storage. What is the name of the datasource used as client store? Now, proceed to the datasource page and check out the settings for the client datasource. To which machine/database server does this datasource point?
    Jot down the server settings and credentials of the other datasources configured in the Administrator. To which machine/database server do these datasources point?

Maybe you are looking for