Call an Oracle function from Java

后端 未结 4 631
鱼传尺愫
鱼传尺愫 2020-12-04 01:41

I am having issues calling an Oracle FUNCTION (not a Stored Procedure) from Java 1.6, using ojdbc14.jar.

I do not know what the function contains as I am calling it

4条回答
  •  无人及你
    2020-12-04 01:59

    You need to define parameter returned by function:

    String call = "{ ? = call FCRLIVE.AP_CH_GET_ACCT_BALANCES(?, ?, ?, ?, ?) }";
                      CallableStatement cstmt = conn.prepareCall(call);
                      cstmt.setQueryTimeout(1800);
                      cstmt.registerOutParameter(1, ...Type returned by function);
                      cstmt.setString(2, inputCode);
                      cstmt.registerOutParameter(3, oracle.jdbc.OracleTypes.NUMBER);
                      cstmt.registerOutParameter(4, oracle.jdbc.OracleTypes.VARCHAR);
                      cstmt.registerOutParameter(5, oracle.jdbc.OracleTypes.CHAR);
                      cstmt.registerOutParameter(6, oracle.jdbc.OracleTypes.CHAR);
                      cstmt.executeUpdate();
    

提交回复
热议问题