Help required in JDBC Stored Procedure

Hi All,
i have a requirement where i need to update the Database table using Stored Procedure from PI.
I have the receiver JDBC channel and have done the mapping.
The stored procedure has inputs of type NUMBER, VARCHAR2,DATE. in the message mapping i tried passing the same values in the type field, it throwed an error like UnSuppoted Format. Then i changed the type to integer for NUMBER and String for Varchar2 then also it is throwing an error like
+java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'PUT_XXXXX' ORA-06550: line 1, column 7: PL/SQL: Statement ignored +
Can any please help with what type i need to send from PI to Stored procedure?
Also, there two out type fileds defined in the Stored procedure..which i didnt create in my PI structure. Do we need to create that fileds in our structure?
Please help me.
Thanks,
Hemanth.

Hi Hemanth Kumar,
I understand that you want to execute a stored procedure using JDBC receiver channel and looking at error message, you think there is an issue with type defined in Data Type.
Now you need to debug step by step.
Step 1:- In Interface Mapping Determination, do not refer to Operational Mapping (delete only OM from there, not the receiver Message Interface). By doing so, you are not call the OM (which refer to Graphical Mapping (MM refer to Data Type (which you think is wrong)). Note: As there is no OM, we need to send the exact payload required by receiver JDBC from Runtime Work Bench, for testing purpose.
Step 2:- In receiver JDBC channel, change u2018Message Protocolu2019 from u201CXML SQL Formatu201D to u201CNative SQL Stringu201D. By doing this, you can do testing very fast; receiver JDBC channel will take only String. And we need to send the exact String which is needed by JDBC Stored Procedure. [Link1|http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7c24a75cf83672e10000000a114a6b/frameset.htm]
Step 3:- Now from RWB test the scenario. Payload should like this, please take help of Data base team to find the String which needs to send.
EXECUTE PUT_uspAddress @City = 'New York'
OR If you have access to the database, logon to it directly and try running the Stored Procedure.
Step 4:- Now, you should have the string which executes the Stored Procedure correctly to go ahead. Your job is 60% done.
Step 5:- Now, in receiver JDBC channel, change u2018Message Protocolu2019 from u201CNative SQL Stringu201D to u201CXML SQL Formatu201D. So that receiver JDBC channel will take only XML.
Step 6:- So now, you have to construct equalant XML structure to String you got in Step 4.
It may look like this [Link2|http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7b72b2fde93673e10000000a114a6b/frameset.htm]
<StatementName>
    <storedProcedureName action=u201D EXECUTEu201D>
       <table> PUT_uspAddress </table>
        < City [isInput=u201Dtrueu201D] type=SQLDatatype>val1</ City>
    </storedProcedureName >
  </StatementName>
Step 7:- Now use the XML you have constructed in Step 6, to test the scenario from RWB. Try to correct if you come up with some errors. Your job is 90% done.
Step 8:- Now, in Interface Mapping Determination refer back the Operational Mapping again, which contain the Message Mapping. Make sure that Message Mapping give the XML output same as XML you have developed in Step 6.
FYI. 1. Whatever youu2019re sending, it will be converted to JDBC statement and will be executed on the database. logSQLStatement(JDBC Additional parameters sapnote_0000801367) will be show in logging not in payload.
2. Most of the cases, type defined in Data Type has no control of what we can send in that element (except Date type). Let say, you can define an element u2018Ageu2019 as u2018numberu2019, but you can always send u201Casdfasdfu201D as input in Message Mapping.
Regards,
Raghu_Vamsee

Similar Messages

  • Help required in a Stored Procedure

    I have a stored procedure as follows:
    create or replace
    PROCEDURE ACCOUNT_HISTORY_PROC_TEST (v_accountid IN VARCHAR2 DEFAULT NULL,
                                            v_enddate IN Date DEFAULT NULL,
                                            cv_1 IN OUT SYS_REFCURSOR,
                                            flag IN INTEGER,
                                            v_Error OUT NOCOPY NVARCHAR2
                                          ) AS
       DAY_1 varchar(4000);
       DAY_2 varchar(4000);
       DAY_3 varchar(4000);
       DAY_4 varchar(4000);
       DAY_5 varchar(4000);
       DAY_6 varchar(4000);
       days_Diff number default 0;
       currdate date;
    BEGIN --Stored Procedure Beginning
    /*If the Account History Table has the Account Id then the following will be executed*/
       IF flag = 0 THEN --1st IF
         Select CurrentDate,DAY2,DAY3,DAY4,DAY5,DAY6 into currdate,DAY_2,DAY_3,DAY_4,DAY_5,DAY_6 from ACCOUNT_STATS_TABLE where Account_id = v_AccountId;
    /*If the transaction is on the same day then the following will be executed*/
          IF currdate = v_endDate THEN --2nd IF
              OPEN cv_1 FOR
                    Select DEPOSIT_CNT,DEPOSIT_AMT,WITHDRAWAL_CNT,WITHDRAWAL_AMT,ATM_CREDIT_CNT,ATM_CREDIT_AMT,ATM_DEBIT_CNT,ATM_DEBIT_AMT,CASH_CREDIT_CNT,CASH_CREDIT_AMT,CASH_DEBIT_CNT,CASH_DEBIT_AMT,CLRNG_CREDIT_CNT,CLRNG_CREDIT_AMT,CLRNG_DEBIT_CNT,CLRNG_DEBIT_AMT,TRANSFER_CREDIT_CNT,TRANSFER_CREDIT_AMT,TRANSFER_DEBIT_CNT,TRANSFER_DEBIT_AMT,CUMMULATIVE_CNT,CUMMULATIVE_AMT,CASH_COUNT,CASH_AMOUNT,DAY1,DAY2,DAY3,DAY4,DAY5,DAY6,CDAY_DEPOSIT_COUNT,CDAY_DEPOSIT_AMOUNT,CDAY_WITHDRAWAL_COUNT,CDAY_WITHDRAWAL_AMOUNT,CDAY_ATM_CREDITTXN_COUNT,CDAY_ATM_CREDITTXN_AMOUNT,CDAY_ATM_DEBITTXN_COUNT,CDAY_ATM_DEBITTXN_AMOUNT,CDAY_CASH_CREDITTXN_COUNT,CDAY_CASH_CREDITTXN_AMOUNT,CDAY_CASH_DEBITTXN_COUNT,CDAY_CASH_DEBITTXN_AMOUNT,CDAY_CLEARING_CREDITTXN_COUNT,CDAY_CLEARING_CREDITTXN_AMOUNT,CDAY_CLEARING_DEBITTXN_COUNT,CDAY_CLEARING_DEBITTXN_AMOUNT,CDAY_TRANSFER_CREDITTXN_COUNT,CDAY_TRANSFER_CREDITTXN_AMOUNT,CDAY_TRANSFER_DEBITTXN_COUNT,CDAY_TRANSFER_DEBITTXN_AMOUNT,CDAY_CUMMULATIVETXN_COUNT,CDAY_CUMMULATIVETXN_AMOUNT,CDAY_CASH_TXN_COUNT,CDAY_CASH_TXN_AMOUNT,CURRENTDATE from ACCOUNT_STATS_TABLE where Account_id = v_AccountId;
    /*If the transaction is not on the same day then the DAY1,DAY2,DAY3,DAY4,DAY5,DAY6 columns will be shifted which will be done in the following part*/
          ELSE --2nd ELSE
            days_diff:=v_endDate-currdate;
            FOR i IN 1..days_diff LOOP
            DAY_1:=DAY_2;
            DAY_2:=DAY_3;
            DAY_3:=DAY_4;
            DAY_4:=DAY_5;
            DAY_5:=DAY_6;
            DAY_6:='0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0';
            END LOOP;
                      Update ACCOUNT_STATS_TABLE
                                set DAY1 = DAY_1,
                                    DAY2 = DAY_2,
                                    DAY3 = DAY_3,
                                    DAY4 = DAY_4,
                                    DAY5 = DAY_5,
                                    DAY6 = DAY_6,
                                    CDAY_DEPOSIT_COUNT=0,
                                    CDAY_DEPOSIT_AMOUNT=0,
                                    CDAY_WITHDRAWAL_COUNT=0,
                                    CDAY_WITHDRAWAL_AMOUNT=0,
                                    CDAY_ATM_CREDITTXN_COUNT=0,
                                    CDAY_ATM_CREDITTXN_AMOUNT=0,
                                    CDAY_ATM_DEBITTXN_COUNT=0,
                                    CDAY_ATM_DEBITTXN_AMOUNT=0,
                                    CDAY_CASH_CREDITTXN_COUNT=0,
                                    CDAY_CASH_CREDITTXN_AMOUNT=0,
                                    CDAY_CASH_DEBITTXN_COUNT=0,
                                    CDAY_CASH_DEBITTXN_AMOUNT=0,
                                    CDAY_CLEARING_CREDITTXN_COUNT=0,
                                    CDAY_CLEARING_CREDITTXN_AMOUNT=0,
                                    CDAY_CLEARING_DEBITTXN_COUNT=0,
                                    CDAY_CLEARING_DEBITTXN_AMOUNT=0,
                                    CDAY_TRANSFER_CREDITTXN_COUNT=0,
                                    CDAY_TRANSFER_CREDITTXN_AMOUNT=0,
                                    CDAY_TRANSFER_DEBITTXN_COUNT=0,
                                    CDAY_TRANSFER_DEBITTXN_AMOUNT=0,
                                    CDAY_CUMMULATIVETXN_COUNT=0,
                                    CDAY_CUMMULATIVETXN_AMOUNT=0,
                                    CDAY_CASH_TXN_COUNT=0,
                                    CDAY_CASH_TXN_AMOUNT=0,
                                    CurrentDate = v_enddate
                                    where Account_id = v_accountid;
          open cv_1 for
              Select DEPOSIT_CNT,DEPOSIT_AMT,WITHDRAWAL_CNT,WITHDRAWAL_AMT,ATM_CREDIT_CNT,ATM_CREDIT_AMT,ATM_DEBIT_CNT,ATM_DEBIT_AMT,CASH_CREDIT_CNT,CASH_CREDIT_AMT,CASH_DEBIT_CNT,CASH_DEBIT_AMT,CLRNG_CREDIT_CNT,CLRNG_CREDIT_AMT,CLRNG_DEBIT_CNT,CLRNG_DEBIT_AMT,TRANSFER_CREDIT_CNT,TRANSFER_CREDIT_AMT,TRANSFER_DEBIT_CNT,TRANSFER_DEBIT_AMT,CUMMULATIVE_CNT,CUMMULATIVE_AMT,CASH_COUNT,CASH_AMOUNT,DAY1,DAY2,DAY3,DAY4,DAY5,DAY6,CDAY_DEPOSIT_COUNT,CDAY_DEPOSIT_AMOUNT,CDAY_WITHDRAWAL_COUNT,CDAY_WITHDRAWAL_AMOUNT,CDAY_ATM_CREDITTXN_COUNT,CDAY_ATM_CREDITTXN_AMOUNT,CDAY_ATM_DEBITTXN_COUNT,CDAY_ATM_DEBITTXN_AMOUNT,CDAY_CASH_CREDITTXN_COUNT,CDAY_CASH_CREDITTXN_AMOUNT,CDAY_CASH_DEBITTXN_COUNT,CDAY_CASH_DEBITTXN_AMOUNT,CDAY_CLEARING_CREDITTXN_COUNT,CDAY_CLEARING_CREDITTXN_AMOUNT,CDAY_CLEARING_DEBITTXN_COUNT,CDAY_CLEARING_DEBITTXN_AMOUNT,CDAY_TRANSFER_CREDITTXN_COUNT,CDAY_TRANSFER_CREDITTXN_AMOUNT,CDAY_TRANSFER_DEBITTXN_COUNT,CDAY_TRANSFER_DEBITTXN_AMOUNT,CDAY_CUMMULATIVETXN_COUNT,CDAY_CUMMULATIVETXN_AMOUNT,CDAY_CASH_TXN_COUNT,CDAY_CASH_TXN_AMOUNT,CURRENTDATE from ACCOUNT_STATS_TABLE where Account_id = v_AccountId;
          END IF; --END 2nd IF
    /*If the Account History Table does not have Account Id then the following will be executed*/
    ELSE --1st ELSE
    /*If the transaction is in the middle of the month then the AH_PROC_REVISED Stored Procedure will be called*/     
              AH_PROC(v_accountid,v_enddate);
          open cv_1 for
          Select DEPOSIT_CNT,DEPOSIT_AMT,WITHDRAWAL_CNT,WITHDRAWAL_AMT,ATM_CREDIT_CNT,ATM_CREDIT_AMT,ATM_DEBIT_CNT,ATM_DEBIT_AMT,CASH_CREDIT_CNT,CASH_CREDIT_AMT,CASH_DEBIT_CNT,CASH_DEBIT_AMT,CLRNG_CREDIT_CNT,CLRNG_CREDIT_AMT,CLRNG_DEBIT_CNT,CLRNG_DEBIT_AMT,TRANSFER_CREDIT_CNT,TRANSFER_CREDIT_AMT,TRANSFER_DEBIT_CNT,TRANSFER_DEBIT_AMT,CUMMULATIVE_CNT,CUMMULATIVE_AMT,CASH_COUNT,CASH_AMOUNT,DAY1,DAY2,DAY3,DAY4,DAY5,DAY6,CDAY_DEPOSIT_COUNT,CDAY_DEPOSIT_AMOUNT,CDAY_WITHDRAWAL_COUNT,CDAY_WITHDRAWAL_AMOUNT,CDAY_ATM_CREDITTXN_COUNT,CDAY_ATM_CREDITTXN_AMOUNT,CDAY_ATM_DEBITTXN_COUNT,CDAY_ATM_DEBITTXN_AMOUNT,CDAY_CASH_CREDITTXN_COUNT,CDAY_CASH_CREDITTXN_AMOUNT,CDAY_CASH_DEBITTXN_COUNT,CDAY_CASH_DEBITTXN_AMOUNT,CDAY_CLEARING_CREDITTXN_COUNT,CDAY_CLEARING_CREDITTXN_AMOUNT,CDAY_CLEARING_DEBITTXN_COUNT,CDAY_CLEARING_DEBITTXN_AMOUNT,CDAY_TRANSFER_CREDITTXN_COUNT,CDAY_TRANSFER_CREDITTXN_AMOUNT,CDAY_TRANSFER_DEBITTXN_COUNT,CDAY_TRANSFER_DEBITTXN_AMOUNT,CDAY_CUMMULATIVETXN_COUNT,CDAY_CUMMULATIVETXN_AMOUNT,CDAY_CASH_TXN_COUNT,CDAY_CASH_TXN_AMOUNT,CURRENTDATE from ACCOUNT_STATS_TABLE where Account_id = v_AccountId;
    END IF; --END 1st IF
    EXCEPTION
       WHEN OTHERS THEN
      -- open cv_1 for Select DEPOSIT_CNT,DEPOSIT_AMT,WITHDRAWAL_CNT,WITHDRAWAL_AMT,ATM_CREDIT_CNT,ATM_CREDIT_AMT,ATM_DEBIT_CNT,ATM_DEBIT_AMT,CASH_CREDIT_CNT,CASH_CREDIT_AMT,CASH_DEBIT_CNT,CASH_DEBIT_AMT,CLRNG_CREDIT_CNT,CLRNG_CREDIT_AMT,CLRNG_DEBIT_CNT,CLRNG_DEBIT_AMT,TRANSFER_CREDIT_CNT,TRANSFER_CREDIT_AMT,TRANSFER_DEBIT_CNT,TRANSFER_DEBIT_AMT,CUMMULATIVE_CNT,CUMMULATIVE_AMT,CASH_COUNT,CASH_AMOUNT,DAY1,DAY2,DAY3,DAY4,DAY5,DAY6,CDAY_DEPOSIT_COUNT,CDAY_DEPOSIT_AMOUNT,CDAY_WITHDRAWAL_COUNT,CDAY_WITHDRAWAL_AMOUNT,CDAY_ATM_CREDITTXN_COUNT,CDAY_ATM_CREDITTXN_AMOUNT,CDAY_ATM_DEBITTXN_COUNT,CDAY_ATM_DEBITTXN_AMOUNT,CDAY_CASH_CREDITTXN_COUNT,CDAY_CASH_CREDITTXN_AMOUNT,CDAY_CASH_DEBITTXN_COUNT,CDAY_CASH_DEBITTXN_AMOUNT,CDAY_CLEARING_CREDITTXN_COUNT,CDAY_CLEARING_CREDITTXN_AMOUNT,CDAY_CLEARING_DEBITTXN_COUNT,CDAY_CLEARING_DEBITTXN_AMOUNT,CDAY_TRANSFER_CREDITTXN_COUNT,CDAY_TRANSFER_CREDITTXN_AMOUNT,CDAY_TRANSFER_DEBITTXN_COUNT,CDAY_TRANSFER_DEBITTXN_AMOUNT,CDAY_CUMMULATIVETXN_COUNT,CDAY_CUMMULATIVETXN_AMOUNT,CDAY_CASH_TXN_COUNT,CDAY_CASH_TXN_AMOUNT,CURRENTDATE from ACCOUNT_STATS_TABLE where Account_id = v_AccountId;
      v_Error := SQLERRM;
      --dbms_output.PUT_LINE('No data');
    END ; --Stored Procedure End hereI want to modify this a little..
    What i am doing right now is if flag = 0, then I am getting some values from the Account_Stats_Table and comapring if the current_datereturn from the table is same as the passed date..If same then, i return the cursor having the values for the passed accountid..There is two time querying of the table..
    I want to avoid querying the table twice..If current date and passed date both are same then, let it return the results of the opened cursor.. How can i do it.. How can i avoid issuing select queries twice.. Please help..

    You can try this:
    IF flag = 0 THEN --1st IF
    OPEN cv_1 FOR
    Select DEPOSIT_CNT,DEPOSIT_AMT,WITHDRAWAL_CNT,WITHDRAWAL_AMT,ATM_CREDIT_CNT,ATM_CREDIT_AMT,ATM_DEBIT_CNT,ATM_DEBIT_AMT,CASH_CREDIT_CNT,CASH_CREDIT_AMT,CASH_DEBIT_CNT,CASH_DEBIT_AMT,CLRNG_CREDIT_CNT,CLRNG_CREDIT_AMT,CLRNG_DEBIT_CNT,CLRNG_DEBIT_AMT,TRANSFER_CREDIT_CNT,TRANSFER_CREDIT_AMT,TRANSFER_DEBIT_CNT,TRANSFER_DEBIT_AMT,CUMMULATIVE_CNT,CUMMULATIVE_AMT,CASH_COUNT,CASH_AMOUNT,DAY1,DAY2,DAY3,DAY4,DAY5,DAY6,CDAY_DEPOSIT_COUNT,CDAY_DEPOSIT_AMOUNT,CDAY_WITHDRAWAL_COUNT,CDAY_WITHDRAWAL_AMOUNT,CDAY_ATM_CREDITTXN_COUNT,CDAY_ATM_CREDITTXN_AMOUNT,CDAY_ATM_DEBITTXN_COUNT,CDAY_ATM_DEBITTXN_AMOUNT,CDAY_CASH_CREDITTXN_COUNT,CDAY_CASH_CREDITTXN_AMOUNT,CDAY_CASH_DEBITTXN_COUNT,CDAY_CASH_DEBITTXN_AMOUNT,CDAY_CLEARING_CREDITTXN_COUNT,CDAY_CLEARING_CREDITTXN_AMOUNT,CDAY_CLEARING_DEBITTXN_COUNT,CDAY_CLEARING_DEBITTXN_AMOUNT,CDAY_TRANSFER_CREDITTXN_COUNT,CDAY_TRANSFER_CREDITTXN_AMOUNT,CDAY_TRANSFER_DEBITTXN_COUNT,CDAY_TRANSFER_DEBITTXN_AMOUNT,CDAY_CUMMULATIVETXN_COUNT,CDAY_CUMMULATIVETXN_AMOUNT,CDAY_CASH_TXN_COUNT,CDAY_CASH_TXN_AMOUNT,CURRENTDATE
    from
    ACCOUNT_STATS_TABLE
    where
    Account_id = v_AccountId AND CurrentDate = v_enddate;

  • JDBC Stored procedure help required

    Hi All,
    Please let me know simple blogs how to use JDBC Stored procedure or any other method  in receiver jdbc adapter to insert or select in 2 tables
    Please  let me know simple blogs how to use JDBC Stored procedure or any other method  in sender jdbc adapter to select from 2 tables
    Thanks

    Hi,
    I am also looking for JDBC Stored procedure or any other method in sender jdbc adapter to select data from 2 tables
    Thanks

  • JDBC stored procedure not working in Weblogic 12.1.3

    Hi,
    We are migrating from WLS 12.1.2 to 12.1.3.
    We have a JDBC stored procedure which used to work correctly under 12.1.2. I understand that 12.1.2 uses ojdbc5/ojdbc6 jars (11.2.0.x). After migrating to 12.1.3, the stored procedure is not working.
    We have narrowed it down to the different between 12.1.2 using ojdbc5/6 and 12.1.3 using ojdbc7 jars, though we do not understand what the difference here is.
    Connection connection = getConnection();
    CallableStatement callableStatement = connection.prepareCall("{call RECEIPT_LOG (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
    callableStatement.registerOutParameter("PIO_RECEIPT_LOG_ID", java.sql.Types.INTEGER);
    callableStatement.setLong("PIO_RECEIPT_LOG_ID", 0);
    callableStatement.setString("PIO_DRAWER_NAME", request.getDrawerName());
    callableStatement.setString("PIO_DRAWER_FIRST_NAME", request.getDrawerFirstName());
    callableStatement.setString("PIO_DRAWER_OTHER_NAMES", "");
    callableStatement.setString("PIO_DRAWER_STREET_NO", "");
    callableStatement.setString("PIO_DRAWER_STREET", "");
    callableStatement.setString("PIO_DRAWER_LOCALITY", "");
    callableStatement.setLong("PIO_DRAWER_POSTCODE", 0);
    callableStatement.setString("PI_PAYMENT_TYPE", request.getPiPaymentType());
    callableStatement.setLong("PI_APPLICATION_ID", request.getApplicationId());
    callableStatement.setString("PI_PRIMARY_ID", request.getPiPrimaryId());
    callableStatement.setString("PI_SECONDARY_ID", request.getPiSecondaryId());
    callableStatement.setDouble("PI_AMOUNT", request.getPiAmount());
    callableStatement.setInt("PI_TAX_AMOUNT", 0);
    callableStatement.setNull("PI_VPC_TXNRESPONSECODE", java.sql.Types.VARCHAR);
    callableStatement.setInt("PI_VPC_TRANSACTIONNO", 0);
    callableStatement.setString("PI_VPC_MESSAGE", "");
    callableStatement.setString("PI_VPC_ACQRESPONSECODE", "");
    callableStatement.setString("PI_VPC_RECEIPTNO", "");
    callableStatement.setString("PI_VPC_BATCHNO", "");
    callableStatement.setString("PI_VPC_CARD", "");
    callableStatement.setString("PI_VPC_MERCHTXNREF", "");
    callableStatement.setString("PI_VPC_MERCHANT", "");
    callableStatement.setString("PI_VPC_ORDERINFO", "");
    callableStatement.setInt("PI_VPC_AMOUNT", 0);
    callableStatement.setString("PI_VPC_AUTHORIZEID", "");
    callableStatement.registerOutParameter("PO_RECEIPT_NO", java.sql.Types.VARCHAR);
    callableStatement.registerOutParameter("PO_SOURCE_ID", java.sql.Types.INTEGER);
    callableStatement.registerOutParameter("PO_PAYMENT_METHOD_TEXT", java.sql.Types.VARCHAR);
    callableStatement.registerOutParameter("PO_CREATE_COMMENT", java.sql.Types.VARCHAR);
    callableStatement.registerOutParameter("PO_ERROR_MESSAGE", java.sql.Types.VARCHAR);
    boolean isSuccessful = callableStatement.execute();
    Long receiptLogId = callableStatement.getLong("PIO_RECEIPT_LOG_ID");
    Here, when the callableStatement.execute() is fired, the isSuccessful is false and the output parameter receiptLogId is 0
    Any help appreciated.
    Regards,
    Rahul

    Hi All,
    We still haven't figured out what the problem is with JDBC when using ojdbc7.jar but, as an alternate solution we ported the code to Spring JDBC and got it working.
    Regards,
    Rahul

  • Pass a null value to a JDBC stored procedure call?

    pass a null value to a JDBC stored procedure call? Is this even possible? My DBA gave me a procedure to call that sometimes requires a null value. I don't think this is even possible.

    do you mind tell me how to resolve your problem?i using the setnull method,but it doesn't work.

  • JDBC/select/async statement to JDBC/stored procedure/sync call

    Hi
    We have JDBC/select/async statement to JDBC/stored procedure/sync call i.e sender and receiver are JDBC.
    PI has to pick all the the records of single internal order number at a time from sender system and upload to receiver JDBc,
    gets the response and routes to sender/insert statement.
    This should run only once per day.
    We will have multiple Internal orders daily, each order consisting of 10 to 20 records but only one IO related records has
    to upload to Receiver/JDBC
    What are the options available ?
    We have thought of following options
    1. SQL query is already to pick, but we have to pick records at one time daily. example: morning,evening or midnight.
       At that time it can pick multiple times but it should not pick through out day
    2. Is there any option in BPM so that we can group IO's at a time and upload ? If so what are the steps need to use
       Any additonal receive step need to be used to pick the records from the table.
    Thanks

    hi
    as i can understando you, you will receive mani IO and you must execute one IO in the receiver SP? if so, you can solve this usssing a ccBPM where you will have to create a mapping(0.N) where the source and the target structure will be the same, the diferrence will be in the occurrance of the target structure which will have to be 0.N (Tab signature in Message Mapping). then back to the ccBPM define a block with the property ForEach. this will  loop any times accord with the number of IO that you receive from the sender. as a result you will execute one SP for each IO.
    so, you ccBPM will be
    RS>TS>BLOCK(Multiline container and single container of source structure)>TS->SS
    RS:Receive Step
    TS:Trans. Step
    SS:Send Step
    Also the container will be:
    source--> type Abs
    source_multiline --> type Abs
    target -->type Abs
    Thanks
    Rodrigo P.
    Edited by: Rodrigo Alejandro Pertierra on Jun 24, 2010 4:54 PM

  • Problem with JDBC stored procedure

    Hi...
    We are implementing an interface from SAP r/3 4.7 to Oracle DB 9.0. On sender side we have used IDOC Adapter and on Receiver side we have used JDBC Adapter.
    Here we are using stored procedures in JDBC Adapter. I have 2 stored procedures(one for header and one for items) and SISCSO.SISCSO01 IDOC.
    Here we are getting following error in RWB for JDBC Receiver adapter....
    <b>Error</b>
    " Receiver Adapter v2112 for Party '', Service 'BS_ORADEV':
    Configured at 2006-08-16 10:12:14 GMT+05:30
    History:
    - 2006-08-16 11:02:04 GMT+05:30: Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. 'PR_SPARES_VOR_PO_HDR_UPLOAD' (structure 'statement'): java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00201: identifier 'PR_SPARES_VOR_PO_HDR_UPLOAD' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored ".
    <b>My mapping file is like this.....</b>
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:TVS_MST_SPARES_ORDER xmlns:ns0="urn:tvsmotor:salesorder"><statement><PR_SPARES_VOR_PO_HDR_UPLOAD action="execute"><table>PR_SPARES_VOR_PO_HDR_UPLOAD</table><IN_DEALER_ID isInput="true" type="String">efde</IN_DEALER_ID><IN_SPARE_PO_NO isInput="TRUE" type="STRING">sdfsdf</IN_SPARE_PO_NO><IN_PO_DATE isInput="TRUE" type="STRING">12.12.2555</IN_PO_DATE><IN_ORDER_TYPE isInput="TRUE" type="STRING">23</IN_ORDER_TYPE><IN_REMARKS isInput="TRUE" type="STRING">Remark</IN_REMARKS><IN_SAP_SALE_ORD_NO isInput="TRUE" type="STRING">146546</IN_SAP_SALE_ORD_NO><IN_SAP_SALE_ORD_DT isInput="TRUE" type="STRING">12.12.2555</IN_SAP_SALE_ORD_DT><IN_TOT_VAL isInput="TRUE" type="STRING">2323</IN_TOT_VAL></PR_SPARES_VOR_PO_HDR_UPLOAD><PR_SPARES_VOR_PO_DTL_UPLOAD action="execute"><IN_DEALER_ID isInput="TRUE" type="STRING">efde</IN_DEALER_ID><IN_SPARE_PO_NO isInput="TRUE" type="STRING">sdfsdf</IN_SPARE_PO_NO><IN_PO_DATE isInput="TRUE" type="STRING">12.12.2555</IN_PO_DATE><IN_PART_NO isInput="TRUE" type="STRING">cfgdfw4w</IN_PART_NO><IN_ORDER_QTY isInput="TRUE" type="STRING">2</IN_ORDER_QTY><IN_PENDING_QTY isInput="TRUE" type="STRING">20</IN_PENDING_QTY><IN_RATE isInput="TRUE" type="STRING">2432</IN_RATE><IN_TAX isInput="TRUE" type="STRING">18</IN_TAX></PR_SPARES_VOR_PO_DTL_UPLOAD></statement></ns0:TVS_MST_SPARES_ORDER>
    Please help me out with this error... tell me if more information is required.
    Thanks,
    Audumbar.

    hi mario,
    tell me one thing.... does case metter for stored procedure name? and even for the parameters used in stored procedure?
    i have changed the case of stored procedure name... (its small in Oracle) but have not changed the case of parameters....
    after changing the case also i m getting the following error....
    " Receiver Adapter v2112 for Party '', Service 'BS_ORADEV':
    Configured at 2006-08-16 10:12:14 GMT+05:30
    History:
    - 2006-08-16 14:18:19 GMT+05:30: Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. <b>'pr_spares_vor_po_hdr_upload'</b> (structure 'statement'): java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00201: identifier <b>'PR_SPARES_VOR_PO_HDR_UPLOAD'</b> must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored "
    Reply me as soon as possible.
    Thanx,
    Regards,
    Audumbar
    Message was edited by: Audumbar Pikle

  • Help me in calling stored procedure and getting results

    hi
    i have a SP like this
    CREATE OR REPLACE PACKAGE P1 AS
    TYPE g_con_ref_cursor is REF CURSOR ;
    TYPE g_con_error IS RECORD
      error_code NUMBER,
      error_desc varchar2(2000)
    PROCEDURE PROC_CURSOR
    (i_str_userid  IN VARCHAR2,
      o_cur_ref_cur OUT g_con_ref_cursor,
      o_rec_error   OUT g_con_error,
      o_num_status  OUT NUMBER);
    END;
    and i now i am trying to call this SP using my java program
    i am able to register the out put params for 2nd and 4 th variable
    my doubt is how i can register the output param for g_con_errorand how i can get result from this ????
    my java program is like this
    Connection connection = DatabaseHelper.prepareConnection();
    CallableStatement proc = connection.prepareCall("{ call P1.PROC_CURSOR(?, ?, ?, ?) }");
    proc.setString(1,"jn26557");
    proc.registerOutParameter(2,oracle.jdbc.driver.OracleTypes.CURSOR);
    proc.registerOutParameter(3,Types.STRUCT,); //HOW TO SET  THIS ?????
    proc.registerOutParameter(4,oracle.jdbc.driver.OracleTypes.NUMERIC);
    proc.execute();
    plz help me in this
    i have no idea how to do it
    any help would be appreciated
    Thanks in advance
    Jaya Prakash Nalajala

    You have the requirements to build the stored procedure, what have you got so far?
    Post your attempt and any errors or issues that you might be experiencing. Writing the whole procedure for you (without the table structure even) is going to be difficult.

  • JDBC stored procedure / java.lang.IllegalArgumentException

    Hi,
    I have created a JDBC adapter to access for a Oracle DB and the connection works successfully. I have tested the posting into the DB via xml-format and it works also fine.
    Accordingly i added a stored procedure (SP) into the xml-format and i get following error in the communication channel (in Pi monitoring the message is fine - no error):
    com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request
    in sax parser: Error when executing statement for table/stored proc.
    'em_end_load' (structure 'STATEMENT_StoreProcedure'):
    java.lang.IllegalArgumentException
    SP in DB:
    PROCEDURE em_end_load
        p_1                      IN  VARCHAR2,
        p_2                      IN  VARCHAR2    DEFAULT NULL,
        p_3                      IN  NUMBER,
        p_4                      IN  VARCHAR2    DEFAULT NULL,
        p_time                      IN  DATE        DEFAULT NULL
    AS
    I'm not sure if i have to use an output parameter, because in the description of the SP i read following:
    USAGE
         To compile from the SQL*Plus prompt:
         SQL> start [folder spec]/sp_em_end_load.pls
         To run from the SQL*Plus prompt:
         SQL> exec em_em_end_load
    PARAMETERS
         INPUT
            p_1
            p_2
            p_3
            p_4
          p_5
          p_6
         OUTPUT
            p_error_msg
    I have created in PI the data type for SP as follow:
                             value
    MT_JDBC
      STATEMENT_SP          0..1
         action          required     EXECUTE
         table          0..1          em_end_load
         p_1          1..1          010
           type          optional     VARCHAR
         p2               1..1          main
           type          optional     VARCHAR
         p3               1..1          100
           type          optional     VARCHAR
         p4               1..1          load
           type          optional     VARCHAR
         p5               1..1          26.04.2010
           type          optional     DATE
         p_error_msg     0..1          
           isInput          optional     1
           type          otpional     VARCHAR
    What is wrong with the processing of this SP? Could anyone help me?
    Regards,
    Lutz

    Sorry the explanation of the data type was a little bit misunderstanding:
    data type in PI:
    MT_JDBC
    -STATEMENT_SP           0..1
    --action                required        EXECUTE
    --table                 0..1            em_end_load
    --p_1                   1..1            010
    ---type                 optional        VARCHAR
    --p_2                   1..1            main
    ---type                 optional        VARCHAR
    --p_3                   1..1            100
    ---type                 optional        VARCHAR
    --p_4                   1..1            load
    ---type                 optional        VARCHAR
    --p_time                1..1            26.04.2010
    ---type                 optional        DATE
    --p_error_msg           0..1
    ---isInput              optional        1
    ---type                 optional        VARCHAR
    ...but the names of the parameters are identical - that i have checked several times.

  • SAP PI JDBC Stored Procedure Call

    Dear All,
    I have a requirement, where i have to call a stored procedure through reciever JDBC adapter by providing multiple records at a time as input to the stored procedure, and also recieve multiple records at a time.
    Can any one tell me, how the structure of data type should be, to provide multiple input to the stored procedure.
    Please reply soon.
    Thanks in Advance.
    Regards,
    Zafar Ali

    For stored procedure the data type should be designed as mentioned in documentaion for JDBC formats-
    http://help.sap.com/saphelp_nw70/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Make the occurance of Statement tag as 0..unbounded to send multiple records in a single message.But each record will inturn call stored procedure.
    Sending multiple records in a single call seems to have restrictions-
    Inserting multiple rows into DB via SQL insert or stored procedure?

  • Jdbc - stored procedures

    Please, can anyone show me how to retrieve an array from a stored procedure using JDBC?
    The code below are not working (the exception at bottom). The problem seem to be the third parameter to registerOutParameter, this type do however exist in the database.
    This error occurs also when I use OracleCallableStatement.
    Any help and tips is MUCH appreciated.
    Thanks!
    ++++++++++++++++++
    java.sql.Connection con;
    java.sql.CallableStatement cstmt = con.prepareCall("{call pck_test_array.get_company_array(?)}");
    cstmt.registerOutParameter(1,java.sql.Types.ARRAY, "pck_test_array.app_user_name_text_table");
    cstmt.execute();
    ++++++++++++++++++++++
    This generates the following exception:
    java.sql.SQLException: Fail to construct descriptor: Unable to resolve type: "pc
    k_test_array.app_user_name_text_table"
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:775)
    at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java:166)
    at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:89)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(Oracl
    eCallableStatement.java:162)

    Here is a sample from Metalink on how to
    fetch arrays from pl/sql
    Program Notes
    o This program can be run with any of the three forms of Oracle JDBC driver.
    o Run the script noted in the comments of the program to create the type
    and the procedure that is called.
    o This program uses the most basic method of calling objects,
    via Oracle.sql.STRUCT.
    References
    "Oracle8i JDBC Developers Guide and Reference" (A64685-01)
    Program
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import java.math.BigDecimal;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    public class callInOutStructArray extends Object {
    This program demonstrates how to emulate calling a stored procedure
    with PL/SQL table of record parameters via JDBC. You cannot call a
    PL/SQL table of records parameter directly, however, you can use an
    Object with the same structure as your table of records.
    The Script used to create the procedure in this example is as follows:
    drop type rectab;
    create or replace type rectype as object(col1 varchar2(10),col2 varchar2(10));
    create or replace type rectab as table of rectype;
    create or replace package ioStructArray as
    procedure testproc(iorec in out rectab,orec out rectab);
    end ioStructArray;
    create or replace package body ioStructArray as
    procedure testproc(iorec in out rectab,orec out rectab) is
    begin
    orec := iorec;
    for i in 1..iorec.count loop
    iorec(i).col1 := orec(i).col2;
    iorec(i).col2 := orec(i).col1;
    end loop;
    end testproc;
    end ioStructArray;
    public static void main(String[] args) throws SQLException {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Connect to the database
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:oci8:@S692815.WORLD",
    "scott", "tiger");
    // First, declare the Object arrays that will store the data.
    Object [] p1recobj = {"FIRST","LAST"};
    Object [] p2recobj = {"SECOND","LAST"};
    Object [] p3recobj;
    Object [] p4recobj;
    // Declare the Object Arrays to hold the STRUCTS.
    Object [] p1arrobj;
    Object [] p2arrobj;
    // Declare two descriptors, one for the ARRAY TYPE
    // and one for the OBJECT TYPE.
    StructDescriptor desc1=StructDescriptor.createDescriptor("RECTYPE",conn);
    ArrayDescriptor desc2=ArrayDescriptor.createDescriptor("RECTAB",conn);
    // Create the STRUCT objects to associate the host objects
    // with the database records.
    STRUCT p1struct = new STRUCT(desc1,conn,p1recobj);
    STRUCT p2struct = new STRUCT(desc1,conn,p2recobj);
    // Initialize the Input array object - to an array of STRUCT Objects.
    p1arrobj = new Object []{p1struct,p2struct};
    // Set up the ARRAY object.
    ARRAY p1arr = new ARRAY(desc2,conn,p1arrobj);
    ARRAY p2arr;
    // Declare the callable statement.
    // This must be of type OracleCallableStatement.
    OracleCallableStatement ocs =
    (OracleCallableStatement)conn.prepareCall("{call iostructarray.testproc(?,?)}");
    // The first parameter is in out so we have to use setARRAY to
    // pass it to the statement
    ocs.setARRAY(1,p1arr);
    // The first parameter is in out, so we have to Register the
    // parameter as well.
    // Note the re use of the TYPE.
    ocs.registerOutParameter(1,OracleTypes.ARRAY,"RECTAB");
    // The second paramter is out, so that has to be registered too.
    // Note the re use of the TYPE.
    ocs.registerOutParameter(2,OracleTypes.ARRAY,"RECTAB");
    // Execute the procedure
    ocs.execute();
    // Associate the returned arrays with the ARRAY objects.
    p1arr = ocs.getARRAY(1);
    p2arr = ocs.getARRAY(2);
    // Get the data back into the data arrays.
    p1arrobj = (Object [])p1arr.getArray();
    p2arrobj = (Object [])p2arr.getArray();
    // Get the data records from each array element (which is of type STRUCT).
    p1recobj = ((STRUCT)p1arrobj[0]).getAttributes();
    p2recobj = ((STRUCT)p1arrobj[1]).getAttributes();
    p3recobj = ((STRUCT)p2arrobj[0]).getAttributes();
    p4recobj = ((STRUCT)p2arrobj[1]).getAttributes();
    // Show the results:
    System.out.println("First Object is now "+p1recobj[0]+" and "+p1recobj[1]);
    System.out.println(" "+p2recobj[0]+" and "+p2recobj[1]);
    System.out.println("Second Object is now "+p3recobj[0]+" and "+p3recobj[1]);
    System.out.println(" "+p4recobj[0]+" and "+p4recobj[1]);
    Sample Output
    First Object is now LAST and FIRST
    LAST and SECOND
    Second Object is now FIRST and LAST
    SECOND and LAST
    Copyright (c) 1995,1999 Oracle Corporation. All Rights Reserved. Legal Notices and Terms of Use.
    null

  • File to JDBC stored procedure

    Hi JDBC gurus,
    I am using the File-XI-JDBC interface in which I am calling a Oracle stored procedure. The parameters I have to send to this SP has one parameter which is a RECORD.
    The input fields which I receive from the File should be send as ONE SINGLE PARAMETER in the stored procedure.
    Is there a way that we can send all these incoming fields into single parameter in the stored procedure?
    Please help.
    Thanks
    Kalyan

    Hi Kalyan,
    You can use XSLT mapping with following function.
    The <xsl:copy-of> element creates a copy of the current node.
    Note: Namespace nodes, child nodes, and attributes of the current node are automatically copied as well!
    Tip: This element can be used to insert multiple copies of the same node into different places in the output.
    Hope it helps,
    Regards,
    Tuhin
    *Please mark useful answers.

  • Testing JDBC - Stored Procedure

    Hi,
    We're working on creating a new JDBC in weblogic server 11g. The data source is created and we have a business service, which was built based on a jca built in JDeveloper. When testing the connection between the server and the db, it seems to be working as expected, but when the business service is executed, which is supposed to executed a stored procedure in the db, nothing is returned even though it should.
    Is there any way to verify whether the business service is executing the stored procedure or not?

    Can you do any of these:
    1 - turn on WebLogic debugging for JDBCSQL, to log all/most JDBC Calls.
    2 - edit the procedure in the DBMS to verify/log when it is called, whether
    it does anything else or not?
    3 - turn on DBMS tracing to log what clients are doing?
    4 - set up/turn on the driver debug logging?
    Depending on the WebLogic version and driver version these may
    be done in different ways, and the instructions are not appropriate
    to all copy here, so I would open a support SR to get help if/as you need it.

  • Regional settings influences jdbc stored procedure calls?

    Hi,
    We have a strange problem: we use a jdbc test client
    that does a simple stored procedure call with one
    input parameter (integer) and one output parameter
    (integer). Like:
    "? = callprocedure(?)" . The database resides on a different server.
    The problem is: this only works when we use "netherlands" regional setting on the windows 2000 machine that
    java client program runs on. If we switch to
    "english (united states)" the call gives other results
    in the output parameter / returns an error code.
    Does this have something to do with the Locale of the
    virtual machine? Or do I have to do something with
    NLS_LANG to eliminate the behaviour that is dependent on
    the windows regional settings? Please help!
    Thanks,
    Michel Schudel
    We use the Oracle JDBC thin driver, latest version.
    (archive: classes12.zip)

    Ok, here it is. Basically, I first call a stored procedure called SETPARAM which receives two Strings:
    a parameter name and a a parameter value. After that, I
    call a procedure called RUNSQLKIT without any input parameters. The output parameter is an integer that indicates the number of "cells" in the output message. After that, I start to retrieve the cells but that is not important here. What happens is: with Dutch regional settings, the number of cells is normal (387) but with
    US settings, the number of cells is -1 (indicates an error.) Why? I use no dates or floating point values as
    input/output!
    Jvm version is 1.3.1_08, oracle driver is 8.1.7
    (Oracle 8i) thin jdbc driver. Oracle runs on AIX.
    conn = m_dataSource.getConnection();
    // Setup the input params
    stmtInput = conn.prepareCall("BEGIN Pck_Sqlmast.setparam(?,?); END;");
    for (final Iterator iter = m_kitParameterNames.iterator(); iter.hasNext();) {
    final String sName = (String) iter.next();
    final String sValue = input.getParameter(sName);
    if (sValue != null) {
    stmtInput.setString(1, sName);
    stmtInput.setString(2, sValue);
    stmtInput.executeUpdate();
    // Call the kit
    stmtRun = conn.prepareCall("BEGIN ? := Pck_Sqlmast.runsqlkit(?); END;");
    stmtRun.registerOutParameter(1, Types.INTEGER);
    stmtRun.setString(2, m_kitName);
    stmtRun.executeUpdate();
    final int iCells = stmtRun.getInt(1);
    Hi Michel,
    Perhaps you would care to post some more information
    including:
    1. Entire error message and stack trace you are
    getting.
    2. The part of your java code where the error
    occurs.
    3. Java version you are using.
    4. Oracle database version you are using.
    5. Platform on which Oracle database is running.
    Good Luck,
    Avi.

  • JDBC Stored Procedure error

    Hi All,
    Interface proxy to JDBC :
    In this I have used stored procedures and implemented structure accordingly.
    issue is while testing the interface its showing error for 1 field
    " Unable to execute statement for table or stored procedure. 'ABCD_SP' (Structure 'ABCD') due to java.sql.SQLException: Unsupported parameter type 'INT' for parameter 'VINSI' found "
    "JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'ABCD_SP' (structure 'ABCD'): java.sql.SQLException: Unsupported parameter type 'INT' for parameter 'VINSI' found "
    I have communicated with DB team and they are saying that field ABCD is "INT" type only . In the same way in my message mapping also i have given INT for Type attribute .
    Please help what is the root cause .
    Vin

    Hi,
    i think you defined Parameter type as "INT" and the value is coming in CHAR formate.
    If Parameter type as "INT" then value should be some number and not Charectors
    If Parameter type as "CHAR" then value should be some Charecters and not NUM.
    Regards,
    Mastan

Maybe you are looking for