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.

Similar Messages

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

  • CR XI - Pass a Multi-value Parameter to a Stored Procedure

    Hello,
    Here is my problem !
    My Main Report accept a Multi-value Parameter "myParameter".
    I create a formula "lstParameter" (Join({?myParameter},',')  linked to my SubReport (string static parameter based on a Stored Procedure  which returns a RefCursor (ORACLE)).
    When I launch the Main Report, he is blank...but if I open the subreport in the overview i can see the result...
    it seems like the MainReport don't call the SubReport, or something like that...
    I hope you can help me !
    Thanks
    Anthony
    Edited by: anthony.44 on Jan 12, 2012 4:53 PM
    Edited by: anthony.44 on Jan 13, 2012 9:51 AM

    hello,
    I resolve my problem....just inside into the detail of the Master report a result of a query (ex: select sysdate from dual)...and the sub report is called correctly

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

  • Passing Multi-Value Parameter to a Stored Procedure

    Has anyone experienced passing a Parameter (MultiValue) to a Stored Procedure? I am aware that Crystal Passes the Param as an Array. How would you go about handling this within a Stored Procedure???

    Hi Daniel
    Try as below:
    1. Create a Crystal report, and add a multi-value parameter.
    2. Since the multi-value parameter is treated as an array, create a formula that uses the JOIN function. Create a formula as below:
    //Formula: @JoinFormula
    Join ({?Multi-value parameter array},";")
    ====================
    NOTE:
    In the formula above, a semi-colon (";") is the delimiter.
    ====================
    3. Within the main report, create a subreport based on the stored procedure, and include the parameter to be populated with the multi-value list.
    4. Link the Join formula in the main report to the stored procedure parameter in the subreport.
    Doing so passes a multi-value parameter to the stored procedure.
    Hope this helps!!!!
    Regards
    Sourashree

  • Would like to pass multi-value parameter to a stored procedure

    Hi,
    Is it possible to pass a multi-value parameter to a stored procedure using crystal reports.
    Is there is a way to do so??/
    Thanks,
    Brian.

    Hi,
    Is it that you want to pass 2 or more parameters to a stored proc. it is possible
    go to database expert
    select your connection and click on add command their you will have to create parameters and pass to a proc
    for ref..
    {CALL `menagerie`.`sp_timer`({?delay time},{?delay time2})}
    where `menagerie`.`sp_timer` is a stored proc.
    and delay time and delay time2 are  parameters.
    but if it is like you have to pass multiple values to stored proc using single parameter as per my experience its
    not possible.

  • Is it possible to pass a null value to a method?

    is it possible to pass a null value to a method?
    like this
    public String getParameterXX(String testvalue)
    String strX = "whatever";
    if(testvalue!=null)
    strX = strX + " man " ;
    Is this possible ?
    is this legal
    String i = getParameterXX(null);

    I also ran a similar code using null in a method, it just considers null as another string and concatenates it so
    public String getParameterXX(String testvalue)
    String strX = testvalue+"whatever";
    return strX;
    public static void main(String [] args)
    Test tt = new Test();
    String i = tt.getParameterXX(null);
    System.out.println(i);
    Gives me "nullwhatever"

  • 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

  • Stored procedure call returns null result set when using temp table in sp!

    Here's a really odd problem...
    SQL Server stored procedure called sp_Test takes 1 input INT. Here is the code I call it with
    cStmt = connection.prepareCall("{call sp_Test(?)}");
    cStmt.setInt(1, 44);
    cStmt.execute();
    rs = cStmt.getResultSet();When the body of the stored proc is
    CREATE PROCEDURE sp_Test(@i_NodeID INT)
    AS
    BEGIN
      SELECT node_id FROM tbl_NavTree
    END
    GOthe query works and I get all node_id back in rs
    BUT when the body of the stored proc is
    CREATE PROCEDURE sp_Test(@i_NodeID INT)
    AS
    BEGIN
      CREATE TABLE #Descendants(
        descendant_id INT
      SELECT node_id FROM tbl_NavTree
      DROP TABLE #Descendants
    END
    GOThe rs comes back as NULL. Really really weird if you ask me. I also tried removing the DROP TABLE line just in case the SELECT had to be the last statement but still NULL.
    Final note is that BOTH the above stored proc bodies work when executed within SQL Server query analyser.
    Must be JDBC .. what can it be!??

    DROP TABLE #DescendantsMS SQL Server - right?
    Then don't drop the table.
    From the MS docs for "create table"
    Local temporary tables are visible only in the current session;
    A local temporary table created in a stored procedure is dropped automatically when the stored procedure completes. The table can be referenced by any nested stored procedures executed by the stored procedure that created the table. The table cannot be referenced by the process which called the stored procedure that created the table.

  • JDBC callableStatement stored procedure call cancellation?

    up vote0down votefavorite
    I have a very complex oracle stored procedure that searches and retrieves some data. The procedure returns an output parameter - an oracle cursor. I execute the procedure by JDBC:
    CallableStatement stmt = conn.prepareCall("{call myprocedure(?,?,?,?}");
    The problem is, the queries can sometimes take quite long (few minutes) and i would like user to be able to cancel the query anytime by clicking button. I have reference to stmt object, but unfortunatelly calling stmt.cancel() (from other thread) has NO EFFECT.
    On the other hand when i change the CallableStatement sql to some query like:
    CallableStatement stmt = conn.prepareCall("select * from all_objects");
    i get "java.sql.SQLTimeoutException: ORA-01013: user requested cancel of current operation" after calling stmt.cancel() - so thats the right reaction.
    Does that mean than i cannot cancel stored procedure call via jdbc, but only simple select statements? Does anyone else had and resolved similar problem?
    I guess i could cancel the query by oracle kill session, but i use connection pooling (jboss) and i have plenty of sessions for the same user existing.
    Database Product Version is Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production JDBC Driver Version is 11.2.0.4.0
    any help will be appreciated.

    This property didnt help, still no reaction after statement.cancel().
    I could not cancel the statment from the db size , so i decided to spawn new java thread and run the statement in that thread, and when user clicks cancel button i just cancel the thread, some snipper of code below:
                   AtomicBoolean userCanceled - this must be AtomicBoolean or  volatile variable, so other threads would see the change of variable after clicking button
                   try{
                    MyCallableQuery callable = new MyCallableQuery(rs,stmt,this,rsh,outParameter);
                    FutureTask<T> queryTask = new FutureTask<T>(callable);
                    ExecutorService executor = Executors.newFixedThreadPool(1);
                    executor.execute(queryTask);                 
                    while  (!queryTask.isDone()){         //stil processing statement            
                     Thread.sleep(100);
                          if (userCanceled)){               //user decided to cancel
                           futureTask1.cancel(true);
                           executor.shutdown();
                           throw new SQLException("User decided to cancel procedure call");
                     result = futureTask1.get(); 
                     //here the code after the resultset has been processed without cancelation
                   catch (SQLException e}{
                   //here the code when user decided to cancel  like clearing the datatable
    and my callable class is like:
    public class MyCallable<T> extends ProcRunner implements Callable<T> {
        private ResultSet rs;
        private CallableStatement stmt;
        private ProcRunner procRunner;
        private ResultSetHandler<T> rsh;
        private Integer outParameter;
        public MyCallable(ResultSet rs,CallableStatement stmt,ProcRunner procRunner,ResultSetHandler<T> rsh,Integer outParameter){
            this.rs = rs;
            this.stmt = stmt;
            this.procRunner = procRunner;
            this.rsh = rsh;
            this.outParameter = outParameter;
        @Override
        public T call() throws Exception {
           T result = null;     
          stmt.executeUpdate();
           rs = (ResultSet) stmt.getObject(outParameter);
           rs = this.wrap(rs);
           result = rsh.handle(rs);  
        return result;

  • 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

  • DML visibility in stored procedures called via JDBC

    Hello,
    I have two stored procedures, A and B. Proc A inserts Q into table X. Proc B selects Q from table X to insert it into table Y. Neither procedure does a COMMIT.
    My Java class executes Proc A and then Proc B within a transaction (autocommit is false). But Proc B fails to select Q from table X with the No Data Found error, apparently unable to see the recently inserted Q.
    If these two procedures are called from a SQL*Plus block, everything succeeds.
    Does anyone have a clue about what I am missing? All my DML should be visible to my session.
    Thank you in advance for any suggestions.
    - CJ

    Thank you, Joe, for your reply!
    To the best of my knowledge, all of my stored procedure calls are being made from the same connection so I can rollback everything if necessary. I have not explicitly closed the connection between calls. The debugger indicates my connection session id never changes across calls.
    Do you know of any JDBC trace tools that might help me verify my connections? I've enabled logging with oracle.jdbc.driver.OracleLog.setTrace(true) but it doesn't really give me specific connection information - at least not that I can tell. :)
    Thanks!
    Cori

  • How to use Stored Procedure Call in Sender JDBC adapter

    Hi All,
             Could someone send me a blog on how to use Stored Procedure call in Sender JDBC adapter?
    Xier

    Hi Xler
    refer these links
    /people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Also, you can check Sriram's blog for executing Stored Procedures,
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    /people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
    This blog might be helpfull on stored procedures for JDBC
    JDBC Stored Procedures
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Please go through these threads and see if it helps...
    Re: How to execute Stored Procedure?
    Re: Problem with JDBC stored procedure
    Thnaks !!

  • Date/Time Format Stored Procedure Calls in ADVANCE MODE in JDBC ADAPTER

    Hi Experts,
    What is significance of Date/Time Format Stored Procedure Calls in ADVANCE MODE in JDBC ADAPTER.
    Thanks,
    ABDUR

    I guess this would be applicable for the folowing formats - DATE, TIME, TIMESTAMP.
    This is the correct link
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
    Regards,
    Prateek

  • Stored Procedure call from JDBC sender for Oracle Database

    Hi,
    I have a requirement to call stored procedure using JDBC sender adapter for retriving data from an Oracle database.
    I need to execute first stored procedure call from Querry SQL statement and then trigger second stored procedure call for confirming the succesful retrival of those records from the update SQL statement.
    Querries:
    1. Can we trigger stored procedure from Update statement of JDBC sender.
    2. Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
    3. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
    Please note PI does not have direct access to main table and hence the need to have separate stored procedure calls.
    The PI version is PI 7.11 sp4.
    Appreciate your inputs.
    Thanks.
    Siddhesh S.Tawate

    >1. Can we trigger stored procedure from Update statement of JDBC sender.
    I think not possible using update statement.
    > Can we call stored procedure from Querry statement, since I have read on other sdn threads that stored procedure calls on Oracle database are not allowed. If not possible to have "Execute stored procedure" would the function call (select * from table(function name)) work same as stored procedure.
    Yes using select query you can call stored procedure.
    >. In a JDBC sender the Querry statement and Update statement are executed in same session call and same database connection. What happens if the querry statement was not succesful, would the update be still triggered.
    No select and update handles in the same session using the same thread so if one transaction fails update should not proceed.

Maybe you are looking for

  • Installation problem with Enterprise Manager Console

    When i am installing 10G database installation was failed at configuring DBConsole. later from OUI(Oracle Universal Installer) i uninstalled Enterprise Manager Console. my Question was how to reinstall the Enterprise Manager Console alone? When i am

  • How can I merge bookmarks and saved passwords from two computers onto one computer?

    Before I got rid of my old computer, I backed up my profile folder on a thumb drive. Then, I got a new computer and started customizing firefox, adding bookmarks and new saved passwords, without ever uploading my passwords and bookmarks from my old c

  • Install EAS client 11.1.1.3 on Windows 7 64 bit.

    Hello All, I am trying to install EAS, Smartview and Excel addin clients on Windows 7 64 bit computer to connect the server which is 64 bit on windows 2003. Is there a separate process to do that for Windows 7? Also what all zip files to download fro

  • Aple tv no longer showing up in iTunes

    Anyone know why my 1st generation AppleTV's (2) are no longer showing up in itunes?  I used to be able to see them and could tell when they are syncing.  Now they no longer dowload content either. Thanks!

  • LSMW: error message u00ABNo logicial path specifiedu00BB

    Hello, I'm trying to create an LSMW for the MIGO transaction. At step 1, I chose the object 0110 andmethod 0000 which brings program RM07MMBL and program type «B» (batch input) by default. When I get to step 7 «Specify file», I specified a file at th