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);

Similar Messages

  • 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 to call stored procedure with several IN pars and single REF Cursor

    Hi,
    Oracle 9.2.0.1
    Ole DB Provider I've got with ODP 9.2.0.4
    First I try to call packaged procedure with single
    REF CURSOR - it works fine(PROCEDURE getDep(dep OUT DEPART.refcur) IS ...).
    When I try to call procedure with additional IN parameter, I get an error ORA-01008: not all variables bound.
    Packaged procedure: PROCEDURE getDep(dep OUT DEPART.refcur, i1 IN number) IS .... and so on.
    Try to call from C#:
    cmd.CommandText = "{call depart.getDep(?)}";
    OleDbParameter par0 = cmd.CreateParameter();
    par0.Value = some value;
    par0.DbType = DbType.Int16;
    par0.OleDbType = OleDbType.Integer;
    par0.Direction = ParameterDirection.Input;
    OleDbDataAdapter da = new OleDbDataAdapter(cmd.CommandText,con);
    DataSet ds = new DataSet();
    da.Fill(ds);
    Connection string:
    "Provider=OraOLEDB.Oracle;User Id=scott;Password=tiger;Data Source=ora92;OLEDB.NET=true;PLSQLRSet=true"
    Please, HELP !
    Thanks in advance,
    Vyacheslav

    Hi,
    Are you using OLEDB.NET driver (System.Data.Oledb) or ODP.NET driver (Oracle.DataAccess)?
    If you are using ODP.NET, remember that you need to bind the refcursor output variable also (besides the numbder)
    Arnold

  • Calling an Oracle stored procedure using Toplink API - Please help

    Hi,
    We are evaluating Toplink as a possible data access layer in large service-oriented application. The ability to call db stored procedures from within business object layer is crucial for our architechture.
    I am trying to follow toplink application developer's guide examples on how to call stored procedures using toplink.
    I have the folling java code:
    call.setProcedureName("PR_ROMAN_TEST");
    call.addNamedArgument("IN_PARAM");
    call.addNamedOutputArgument("OUT_PARAM");
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    query.addArgument("IN_PARAM");
    Vector params = new Vector();
    params.addElement(new Integer(5));
    Number result = (Number) session.executeQuery(query, params);
    This generates the following SQL statement:
    BEGIN PR_ROMAN_TEST(IN_PARAM=>5, OUT_PARAM=>?); END;
    An attempt to execute it causes a
    java.sql.SQLException: Invalid column index.
    As I understand it, this exception is thrown because of the "?" in place of the out-parameter value holder.
    The SQL statement that I would want toplink to generate and execute should look like:
    DECLARE result number; BEGIN PR_ROMAN_TEST(IN_PARAM=>5, OUT_PARAM=>result); END;
    , but how do I achieve it and how do I capture the return value, all using toplink api?
    Please help
    Thank you in advance,
    Roman

    I read the conversation above. I am running into a similar kind of problem. I get the following error.
    <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Error Code: 6550Local Exception Stack: Exception [TOPLINK-4002] (OracleAS TopLink - 10g (9.0.4.5) (Build 040930)): oracle.toplink.exceptions.DatabaseException Exception Description: java.sql.SQLException: ORA-06550: line 1, column 38: PLS-00103: Encountered the symbol "NAME" when expecting one of the following:. ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like as between from using || The symbol "." was substituted for "NAME" to continue.ORA-06550: line 1, column 55: PLS-00103: Encountered the symbol "ID" when expecting one of the following:. ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 38:PLS-00103: Encountered the symbol "NAME" when expecting one of the following . ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like as between from using || The symbol "." was substituted for "NAME" to continue.ORA-06550: line 1, column 55:PLS-00103: Encountered the symbol "ID" when expecting one of the following: . ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Error Code: 6550 at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:227)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:733)
    at oracle.toplink.internal.databaseaccess.DatabasePlatform.executeStoredProcedureCall(DatabasePlatform.java:1605)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:649)
    at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:506)at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:131)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:115)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(CallQueryMechanism.java:194)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelect(CallQueryMechanism.java:175)
    at oracle.toplink.queryframework.DirectReadQuery.executeNonCursor(DirectReadQuery.java:65)
    at oracle.toplink.queryframework.DataReadQuery.execute(DataReadQuery.java:73)
    at oracle.toplink.queryframework.ValueReadQuery.execute(ValueReadQuery.java:59)
    at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:493)
    at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:125)
    at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1958)
    at oracle.toplink.threetier.ServerSession.internalExecuteQuery(ServerSession.java:629)
    at oracle.toplink.threetier.ClientSession.internalExecuteQuery(ClientSession.java:392)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
    at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2246)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1055)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate$2.readFromSession(TopLinkTemplate.java:181)
    at com.eplinc.common.persistence.toplink.SessionReadCallback.doInTopLink(SessionReadCallback.java:59)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.execute(TopLinkTemplate.java:110)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.executeQuery(TopLinkTemplate.java:178)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.executeQuery(TopLinkTemplate.java:172)
    at com.epl.outletteller.dao.toplink.TopLinkOIDGeneratorDAO.generateId(TopLinkOIDGeneratorDAO.java:45)
    The call I am making is as follows :
    public long generateId(String name, long outletId) throws DataAccessException {
    TopLinkTemplate tlTemplate = new TopLinkTemplate();
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("AUTONUM.GET_NEXT_VALUE");
    call.addNamedArgument("autonum name");
    call.addNamedArgument("outlet id");
    call.addNamedOutputArgument("OUTPUT_1");
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    query.addArgument("autonum name");
    query.addArgument("outlet id");
    Object[] parameters = new Object[2];
    parameters[0] = name;
    parameters[1] = Long.toString(outletId);
    Number uniqueNumber = (Number)tlTemplate.executeQuery(query,parameters);
    return uniqueNumber.longValue();
    This is my Table AUTONUM_SETTING
    AUTONUM_NAME AUTONUM_TYPE START_VAL END_VAL INCREMENT_VALUE
    TRAN_NUM GLOBAL 1 999999 1
    TRACE_NUM OUTLET 1 999999 1
    Any help would be appreciated. Thanks

  • Error while executing Multiple Stored Procedure through .sql file

    Hi Guru's.
    I am new to ORACLE. I am facing problem while creating Stored Procedure through .sql file.
    I have one test.sql file with Stored Procedure is like,
    CREATE OR REPLACE PROCEDURE skeleton1
    AS
    BEGIN
         DBMS_Output.Put_Line('skeleton1');
    END skeleton1;
    CREATE OR REPLACE PROCEDURE skeleton2
    AS
    BEGIN
         DBMS_Output.Put_Line('skeleton2');
    END skeleton2;
    Now when i try to execute this test.sql file through SQL PLUS it gives me Error like this
    I am opening test.sql file from SQL PLUS,
    SQL>
    1 CREATE OR REPLACE PROCEDURE skeleton1
    2 AS
    3 BEGIN
    4 DBMS_Output.Put_Line('skeleton1');
    5 END skeleton1;
    6 /
    7 CREATE OR REPLACE PROCEDURE skeleton2
    8 AS
    9 BEGIN
    10 DBMS_Output.Put_Line('skeleton2');
    11* END skeleton2;
    SQL> /
    Warning: Procedure created with compilation errors.
    SQL> show errors;
    Errors for PROCEDURE SKELETON1:
    LINE/COL ERROR
    6/1 PLS-00103: Encountered the symbol "/"
    SQL>
    Please suggest how to create multiple CREATE PROCEDURE using single .sql script file....
    Regards,
    Shatrughan

    Hi,
    Try this
    CREATE OR REPLACE PROCEDURE skeleton1
    AS
    BEGIN
    DBMS_Output.Put_Line('skeleton1');
    END ;
    CREATE OR REPLACE PROCEDURE skeleton2
    AS
    BEGIN
    DBMS_Output.Put_Line('skeleton2');
    END;
    /Save the file and call it.
    Regards,
    Bhushan

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

  • Problems calling stored procedure with DG4IFMX

    Hi guys,
    I am trying to call stored procedures from Informix Database which is connected through Oracle Database Gateway for Informix.
    I have run select,update,delete successfully but when i try to run a stored procedure nothing happens.
    for example :
    when i run
    call "branko"@link_informix(1)
    it returns that it is successfully executed, without any error, but as u can see bellow no entry is entered in the branko_test table
    at informix :
    drop procedure branko;
    create procedure "informix".branko(_vlez integer)
    returning boolean;
    if _vlez = 1 then
    insert into branko_test values('test uspesen','1');
    else
    insert into branko_test values('test uspesen 2','2');
    end if;
    end procedure;
    the procedure runs ok when called from informix.
    Thank you for any help
    P.S i have even tried running:
    declare
    ret integer;
    begin
    ret := DBMS_HS_PASSTHROUGH.EXECUTE_IMMEDIATE@link_informix('execute procedure branko(2)');
    end;
    but the same thing is happening, no entry in the table branko_test.

    Found the root cause:
    when using dbaccess to call the original procedure it reports on the screen (expression)
    => removing the return value as it is not handled
    -> looks like the unhandled return value boolean. Modifying the procedure to
    drop procedure branko;
    create procedure "informix".branko(_vlez integer)
    if _vlez = 1 then
    insert into branko_test values('test uspesen','1');
    else
    insert into branko_test values('test uspesen 2','2');
    end if;
    end procedure;
    allows me to execute the procedure using passthrough
    DECLARE
    result VARCHAR2(50);
    BEGIN
    result := DBMS_HS_PASSTHROUGH.EXECUTE_IMMEDIATE@dg4ifmx('execute procedure informix.branko(1)');
    END;
    Edited by: kgronau on May 6, 2011 7:31 AM

  • Weird Problem calling Stored Procedure using JDBC

    Scenario is..
    I have J2EE application and calling stored procedure using JDBC.
    My application connects to instance "A" of testDB.
    Schema "A" does NOT own any packages/procedure but granted execute on oracle packages/procedures that reside in schema "B" of testDB.
    In java code I call procedure(proc1) in package(pac1) which internally calls procedure(proc2) in package(pac2).
    The problem occurs when procedure pac2.proc2 is modified. After the modification, my java code fails and throws an exception "User-Defined Exception" and I am also getting "ORA-06508: PL/SQL: could not find program unit being called". This clears up only if I bounce the web container. (This doesn't happen if I modify pac1.proc1 and run my application)
    Has any one faced this problem? Please suggest if any thing can be changed in jdbc code to fix this problem.
    Thanks

    Hi,
    I assume these are PL/SQL packages and that the changes are made at the package specification level?
    If so, it looks like you are hitting the PL/SQL dependencies rules. In other words, if the spec of proc2 is changed, then proc1 is invalidated, since proc1 still depends on the old version of proc2's spec. As a result, if you try to run proc1, its spec must either be explicitly rewritten before it could run again or implicitly recompiled first, if the (implicit) recompilation fails, it won’t run.
    Kuassi http://db360.blogspot.com

  • Need sample source code for calling stored procedure in Oracle

    Hi.
    I try to call stored procedure in oracle using JCA JDBC.
    Anybody have sample source code for that ?
    Regards, Arnold.

    Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
    I have the Procedure defined as below in the SFCS1 package body
    Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
    BEGIN
    Open O_Cursor FOR
    SELECT CompanyId, CompanyName
    FROM Company
    WHERE CompanyProvince IN ('AL','AK');
    END Company_Selection;
    In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
    At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
    DECLARE
    A SFCS1.T_Cursor;
    BEGIN
    SFCS1.Company_Selection(A);
    go_Block ('Block36');
    The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause.

  • Error while executing the stored procedure through sender JDBC adapter

    Hi All,
    I am getting below error while executing the stored procedure through sender JDBC adapter.
    Database-level error reported by JDBC driver while executing statement 'exec SapgetNextEntity 'SalesOrder''. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
    what is the problem? any idea to anyone...
    regards
    Ramesh

    hi Dharamveer,
    I am not getting below statement for your reply
    Try to use Refrence Cursor it will return u reference of resultset.
    I mention SP like this
    exec SapgetNextEntity 'SalesOrder'
    SapgetNextEntity -
    > SP Name
    SalesOrder----
    > Parameter I am passing...
    regards
    Ramesh

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • Calling Stored Procedure which returns single or multiple value

    Hi All Experts,
    I have written one stored procedure which is returning different
    integer values according to condition.I am calling this
    stored procedure through prepareCall() method then executeUpdate() method ,but it is always returning 1,not my desired value.
    Pl also tell me,if my stored procedure returns more than one value
    then how will i get those values in my java program?
    Pl help by writing some sample code.
    Thanx in Advance.
    Pradipto

    1) Create CallableStatement
    2) For each of returning value you have to call RegisterOutParameter()
    3) For others user setXXX() method depending on type of parameter
    4) call
    5) use vars registered through RegisterOutParameter() - all your values should be there
    Pavel

  • Calling stored procedure in OCCI

    Hi, Guys.
    I triy to call stored procedure in Oracle database server.But i have problems with taking of the OUT parameters.
    How to call the procedure corectly?
    Depend on Oracle manual everything is fine but as we see that is not.
    Here is the 2 lines that make the problem.
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    I can't access Type::OCCIINT and Type::OCCIString.
    I tried and Type::OCCISTRING but without any result.
    Can you help me?
    This is the all code i use:
    Environment *env = Environment::createEnvironment ( Environment::DEFAULT );
    Connection *conn = env->createConnection ( user, pass, osid );
    Statement * statement = conn->createStatement ( query );
    ResultSet * result = statement->executeQuery ( query );
    result->setCharacterStreamMode ( 2, 10000 );
    statement->setSQL ( "BEGIN tracetst.get_tst_moduls ( :1, :2, :3 ); END:" );
    int if_false;
    string __result;
    statement->setString ( 1, "116714020010" );
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    statement->executeUpdate();
    if_false = statement->getInt (2);
    /* Set the 1,2 args into err_result and modules. The action is only with these */
    err_result = if_false;
    __result = statement->getString (3);
    cout << if_false;
    cout << __result;
    //printf ( result );
    //statement->executeUpdate ( query );
    env->terminateConnection ( conn );
    Environment :: terminateEnvironment ( env );
    While compiling I have an error message.Here it is :
    trace.cpp: In member function `const char* oracle_io::get_data()':
    trace.cpp:668: error: `oracle::occi::Type' is not an aggregate type
    Tha is the line adn the next line is same :
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    How to call the procedure corectly?
    Depend on Oracle manual everything is fine but as we see that is not.
    Thanks in advance.
    P.S. I would like to thanks to Amogh for helping me before.

    Did you remove the colon after END ?
            Environment *env = Environment::createEnvironment(Environment::OBJECT);
            Connection *conn = env->createConnection("scott","tiger","inst1");
            Statement *stmt;
            int num; string name;
            try
                    stmt=conn->createStatement();
                    stmt->setSQL ( "BEGIN scott.test ( :1, :2, :3 ); END;" );
                    stmt->setString ( 1, "11" );
                    stmt->registerOutParam(2, OCCIINT,sizeof(num));
                    stmt->registerOutParam(3, OCCISTRING,sizeof(name));
                    stmt->execute();
                    num=stmt->getInt(2); name=stmt->getString(3);
                    cout<<num<<"   "<<name<<endl;
            catch (SQLException &ex)
                    env->terminateConnection(conn);
                    Environment::terminateEnvironment(env);
                    cout<<ex.getMessage();
            env->terminateConnection(conn);
            Environment::terminateEnvironment(env);
    ...Rgds.
    Amogh

Maybe you are looking for