3

I'm trying to call a function like this:

PCK_BEE.FUN_FOO(A IN VARCHAR2, B OUT T_CURSOR) RETURN VARCHAR2;
--
TYPE T_CURSOR IS REF CURSOR;
--
TYPE R_DEP  IS RECORD (P_CODE VARCHAR2(3),  P_DESC   VARCHAR2(30));

On MyBatis I created an Object:

public class LovPrc {
   private List<ProcedureTypeLov> lov;
   private String error;

   // Getters and Setters
}

ProcedureTypeLov:

public class ProcedureTypeLov {
   private String code;
   private String description;

   // Getters and Setters
}

Mapper:

<select id="lovDep" resultType="LovPrc" parameterType="map" 
           statementType="CALLABLE">
    { #{error, mode=OUT, jdbcType=VARCHAR} = call 
        PCK_BEE.FUN_FOO(#{A, mode=IN,
                        #{lov, jdbcType=CURSOR, 
                              mode=OUT, resultMap=LovPrc, javaType=java.sql.ResultSet})}
</select>

POJO is returning the object but I'm getting it as null.

How I should call this type of function and return it on the POJO? Can't change it to a PROCEDURE with both parameters as OUT

1 Answer 1

1

Handled this yet, this is how I make it work:

<select id="lovDep" parameterType="LovPrc" statementType="CALLABLE">
{ #{error,jdbcType=VARCHAR,mode=OUT} = call PCK_BEE.FUN_FOO(#{A, mode=IN, jdbcType=VARCHAR},
                                                            #{lov, jdbcType=CURSOR, resultMap=MapLov, mode=OUT})}
</select>

<resultMap id="MapLov" type="ProcedureTypeLov">
     <result column="A (name of the column returned by CURSOR)" property="a"/>
</resultMap>

LovPrc as parameter Object for the call and out Object to handle the response.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.