0 Replies Latest reply on Apr 4, 2017 5:21 PM by d5497b18-395a-4253-8d6f-8fd59ebbb68d

    CallableStatement | java.sql.SQLException: Invalid column index

    d5497b18-395a-4253-8d6f-8fd59ebbb68d

      In sqlplus64 I am successfully able to call the function like this:

       

      declare

        idMess raw(255);

        text clob;

        hex_res varchar2(128);

        p_corr varchar2(128) := '4C5B1D09CB48334AE053036518AC1537';

      begin

        idMess := Z$CIT_BO_EXT_CALL_LIB.get2clob('queue_id', text, p_corr, p_aq_in => false, p_time_out => 60 );

      commit; 

      dbms_output.put_line(text);

      end;

       

      The response will be placed in the text variable.

      I'd like the same result with java (actually I use kotlin in the example)

       

       

      val getRequest = """{?=call Z${'$'}cit_bo_ext_call_lib.get2clob('queue_id', ?, ?, p_aq_in => false, p_time_out => 60 )}"""
      var responseStatement = conn.prepareCall(getRequest)

      responseStatement.registerOutParameter(1, OracleTypes.VARCHAR)

      responseStatement.registerOutParameter(2, OracleTypes.CLOB)

      responseStatement.setBytes(3, requestId)

      responseStatement.execute()

      var responseId = requestStatement.getObject(2)

       

       

      After timeout I receive the following error:

      java.sql.SQLException: Invalid column index

              at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:5050)

              at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:2907)

       

      At line:

      var responseId = requestStatement.getObject(2)

       

      Definitely something wrong here, but cannot catch it.

      Thanks in advance