How can a Java method returns more than one value

One of my friends asks me this question, can a java method returns than more value?
- you can achieve this task through a work around

Consider this example

    public static java.math.BigDecimal pmsGetActRetB(java.math.BigDecimal P_ID, java.math.BigDecimal P_HON_ID,
                                                     oracle.jbo.domain.Date P_DATE,
                                                     java.math.BigDecimal P_NAV[]) throws java.sql.SQLException {
        java.math.BigDecimal __jPt_result = null;
        CallableStatement __sJT_st = null;
        try {
       
                    String theSqlTS =
                        "BEGIN :1 := IAIGC.\"PMS_RET_PKG\".PMS_GET_ACT_RET_B(\n       :2  ,\n       :3  ,\n       :4  ,\n       :5  )  \n; END;";
                   
                    __sJT_st.registerOutParameter(1, oracle.jdbc.OracleTypes.NUMERIC);
                    __sJT_st.registerOutParameter(5, oracle.jdbc.OracleTypes.NUMERIC);
                    // set IN parameters
                    __sJT_st.setBigDecimal(2, P_ID);
                    __sJT_st.setBigDecimal(3, P_HON_ID);
                    __sJT_st.setObject(4, P_DATE);
                    __sJT_st.setBigDecimal(5, P_NAV[0]);
                    // execute statement
                    __sJT_st.executeUpdate();
                    // retrieve OUT parameters
                    __jPt_result = __sJT_st.getBigDecimal(1);
                    P_NAV[0] = __sJT_st.getBigDecimal(5);
                } finally {
                    __sJT_st.close();
                }
         
        return __jPt_result;
    }

This example call a database function that contains out parameter and return a number value too.

Comments

Popular posts from this blog

Detail entity with row key null cannot find or invalidate its owning entity.

Another user has changed the row with primary key oracle.jbo.Key[12 ].

setDomainEnv file in weblogic